我在/abc/
子目录中有很多网址链接,比如
http://www.domain.com/abc/products-12345
http://www.domain.com/abc/products-23456
http://www.domain.com/abc/products-34567
http://www.domain.com/abc/new-items
现在我要url rewrite
/abc/products-
到/def/products-
http://www.domain.com/def/products-12345
http://www.domain.com/def/products-23456
http://www.domain.com/def/products-34567
http://www.domain.com/abc/new-items
我的代码在.htaccess
,但没有任何改变。在这种情况下如何重写?感谢。
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^abc/products-(.*)$ /def/products-$1 [L,R=301]
</IfModule>
答案 0 :(得分:1)
正如您可以在this simulator上测试规则应该有效。
您面临的最可能的问题应该是:
<IfModule>
指令。最佳故障排除选项是尝试将所有页面重定向到静态页面。如果这不起作用,请查找配置问题。