Regex 未执行重定向规则
我用rubular.com测试了以下重定向规则Regex 未执行重定向规则,regex,.htaccess,redirect,rule,Regex,.htaccess,Redirect,Rule,我用rubular.com测试了以下重定向规则 ^tags\/([a-zA-Z0-9_-]+)\.html 例如,使用/tags/a-led.html返回/tags/a-led。到目前为止,一切看起来都正常,但当我在htaccess中应用规则时,如下所示 RewriteRule ^tags\/([a-zA-Z0-9_-]+)\.html$ /tags/$1 [R,L] 还有其他一些规则 RewriteRule ^(.*)/(d*)-(.*)\.html$ /showthread.php
^tags\/([a-zA-Z0-9_-]+)\.html
例如,使用/tags/a-led.html
返回/tags/a-led
。到目前为止,一切看起来都正常,但当我在htaccess中应用规则时,如下所示
RewriteRule ^tags\/([a-zA-Z0-9_-]+)\.html$ /tags/$1 [R,L]
还有其他一些规则
RewriteRule ^(.*)/(d*)-(.*)\.html$ /showthread.php?$1 [R,L]
RewriteRule ^(d*)-(.*)\.html$ /threads/$2 [R,L]
没有被处决,不幸的是我没有胶水,原因可能是什么
RewriteEngine on
)AllowOverride
设置正确的设置。设置AllowOverride All
将确保应用htaccess文件中的所有内容此外,还可以使用[R,L]检查在此规则之前是否设置了任何其他规则。L告诉apache,如果这个规则匹配,就不要处理更多的规则。是否打开了重写引擎?是否打开了。我还有一些其他的规则,当你进入
http://yourdomain.com/tags/a-led.html
您不会被重定向到http://yourdomain.com/tags/a-led
?但是其他重定向有效吗?不,我的其他重定向似乎没有问题
RewriteEngine On
RewriteRule ^tags\/([a-zA-Z0-9_-]+)\.html$ /tags/$1 [R,L]