繁体   English   中英

RewriteRule不起作用

[英]RewriteRule not working

我试图在我的httpd.conf文件中添加重写规则,但它不起作用。

这是相关部分:

RewriteRule ^/taxonomy/term/([0-9]+)$ http://www.example.com/taxonomy/term/$1 [R=301, L]

目前,我的网站名称是www.domain.com,我正在尝试通过httpd.conf RewriteRule将所有以taxonomy/term/{integer}开头的URL重定向到我的新域www.example.com。

Apache必须抱怨:

RewriteRule:坏标记分隔符

删除标志中的空白区域。 改变这个:

[R=301, L]

至:

[R=301,L]

注意:如果您在每个目录的htaccess文件中使用该规则,则需要省略前导斜杠:

RewriteRule ^taxonomy/term/([0-9]+)$ http://www.example.com/taxonomy/term/$1 [R=301,L]

删除开始斜杠:

 RewriteRule ^taxonomy/term/([0-9]+)$ http://www.example.com/taxonomy/term/$1 [R=301, L]

在httpd.conf中尝试这个(删除空格,不要删除斜杠):

RewriteEngine on
RewriteRule ^/taxonomy/term/([0-9]+)$ http://www.example.com/taxonomy/term/$1 [R=301,L]

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM