我有点坚持使用RewriteRule 301,从OLD News id更改为新的新闻ID
这就是我的尝试:
RewriteRule ^/news/0(.*)$ /news/$1 [L,R=301]
假设新闻URL看起来像他的:
http://www.mydomain.com/news/01/title-of-the-new
http://www.mydomain.com/news/09/title-of-the-new
http://www.mydomain.com/news/012/title-of-the-new
http://www.mydomain.com/news/032/title-of-the-new
我想改为:
http://www.mydomain.com/news/1/title-of-the-new
http://www.mydomain.com/news/9/title-of-the-new
http://www.mydomain.com/news/12/title-of-the-new
http://www.mydomain.com/news/32/title-of-the-new
答案 0 :(得分:1)
我设法修复了替换
RewriteRule ^/news/0(.*)$ /news/$1 [L,R=301]
带
RewriteRule ^news/0(.*)$ /news/$1 [L,R=301]
答案 1 :(得分:0)
答案 2 :(得分:0)
我认为删除所有前置零的更强大的规则更好一点:
RewriteRule ^ news / 0 +(。*)$ / news / $ 1 [L,R = 301]