作为一个站点迁移的一部分,我有一堆的,我想重定向到一个新的站点旧文件。旧的文件全部结束与_reviews.html,但新的目标是不同的服务器上,没有名字的_reviews的一部分,但还是在结束html的。例如:
As part of a site migration, I have a bunch of old files that I want to redirect to a new site. The old files all end with _reviews.html, but the new destination is on a different server, without the "_reviews" part of the name, but still ending in .html. For example:
旧:www.a.com/my_product1_reviews.html 新:www.b.com/my_product1.html
Old: www.a.com/my_product1_reviews.html New: www.b.com/my_product1.html
我有几百个这样的,所以我真的不希望做他们一次一个,但我似乎无法得到正确的语法。谢谢你,
I have a few hundred like this so I didn't really want to do them 1 at a time, but I can't seem to get the correct syntax. Thanks,
比尔
试试这个:
RewriteEngine On
RewriteBase /
RewriteRule (.*)_reviews.html$ http://www.b.com/$1.html [L,R=301]