我在/abc/子目录中有很多url链接,比如
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>发布于 2012-10-12 21:32:12
正如您可以在this simulator上测试一样,这些规则应该可以工作。
你面临的最有可能的问题应该是:
对于apache用户,全局配置不允许overwrite
<IfModule>指令。最好的故障排除选项是尝试将所有页面重定向到静态页面。如果这不起作用,请查找配置问题。
https://stackoverflow.com/questions/12859819
复制相似问题