我正在尝试从
执行重写规则http://website.com/location/new-york.php <- user goes to
到
http://website.com/location/city.php?name=new-york <- u use this in my code
并且根据重写规则,我认为我需要
的例外http://website.com/location/city.php...
有什么想法吗?
答案 0 :(得分:0)
您可以使用否定前瞻在此规则中为/location/
目录中的.htaccess创建例外:
RewriteEngine On
RewriteBase /location/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(?!city\.php$)(.+?)(?:\.php)?$ city.php?name=$1 [L,QSA,NC]