以下是我希望重写的一些示例网址:
https://website.com?c=food&s=cheese&p=3 https://website.com?c=food&s=cheese https://website.com?s=cheese
我希望将上述内容重写为:
https://website.com/food/cheese/3 https://website.com/food/cheese https://website.com/cheese
这是我的 htaccess 文件:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^.*\.(jpg|css|js|gif|png)$ [NC]
RewriteRule ^([^/]*)/([^/]*)/([^/]*)$ /?c=$1&s=$2&p=$3 [L]
RewriteRule ^([^/]*)/([^/]*)$ /?c=$1&s=$2 [L]
RewriteRule ^([^/]*)$ /?s=$1 [L]
谁能看到出了什么问题?我删除最后一行
RewriteRule ^([^/]*)$ /?s=$1 [L]
然而,页面加载,它似乎正在重写 css 和 js 文件?