我的.htaccess文件位于子目录(www.example.com/test/.htaccess)中:
RewriteEngine On
RewriteRule ^([^/d]+)/?$ index.php?state=$1 [QSA]
所以网址:
www.example.com/test/CA/
重定向到:www.example.com/test/index.php?state = CA
但我的问题是:www.example.com/test/form.htm还重定向
有人可以告诉我如何从规则中排除form.htm,以便它转到实际文件而不是重定向吗?谢谢大家的帮助。
答案 0 :(得分:0)
我通过执行以下操作将html和php文件排除在条件之外:
RewriteEngine On
RewriteCond %{REQUEST_URI} !\.(php|htm)$
RewriteRule ^([^/d]+)/?$ index.php?state=$1 [QSA]