DirectoryIndex index.php index.html index.htm
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteRule ^favicon.ico$ - [NC,L]

# 屏蔽直接访问入口文件, 直接访问跳转到404页面, TODO 设置正确的404页面
RewriteCond %{THE_REQUEST} " /index.php.*" [NC]
RewriteRule ^index.php$ /error-404.html [NC,L]

# 访问文件,链接,目录的请求直接放行
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]

# 商品详情页示例
RewriteRule ^(d+).html$ /goods/info/?id=$1 [N]
RewriteRule ^(.*)$ /index.php/$1 [PT,L]

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注