我在虚拟主机中有一个非常简单的重写规则:
RewriteRule ^/?([^.]+)\.([^(htm)]+)$ /$1.htm [L,QSA]
RewriteRule ^/(someotherrule)$ /me [L]打电话给url:http://myurl.com/test.php
我希望规则与之匹配,并将url重写到http://myurl.com/test.htm
相反,我在我的rewriteLog中发现了这一点:
applying pattern '^/?([^.]+)\\.([^(htm)]+)$' to uri '/test.php'
applying pattern '^/(someotherrule)$' to uri '/test.php'
rewrite '/test.php' -> '/me'显然,我的第一次重写规则模式有问题,但我看不出到底是什么。可能是因为我的大脑里有一个因睡眠不足而产生的结。所以,如果有人愿意花点时间指出我的错误,我会非常感激的。
发布于 2013-11-18 17:31:38
您应该替换第一条规则,结果是:
RewriteEngine On
RewriteCond %{REQUEST_URI} !^[^.]+\.htm$ [NC]
RewriteRule ^/?([^.]+)\..*$ /$1.htm [L,QSA]
RewriteRule ^/(someotherrule)$ /me [L]错误出现在^ ( htm)中,这意味着文件扩展名不包含字符:(、h、t、m ),而不是您预期的.htm。
https://stackoverflow.com/questions/20053365
复制相似问题