.htaccess 301与正则expression式redirect

我正在尝试修复我们旧网站中有关产品页面与单个产品相关联的多个url的许多错误。

我希望我可以使用正则expression式与常规redirect301线,但目前为止我似乎无法得到它的工作。

这是我正在尝试的:

redirect 301 /products/(.*?)/(.*?)/5702/(.*?).html http://mycompany.com/footwear/wolverine-boots-waterproof-durashocks-work-boots-2582-33390.html 

有没有人有任何想法,我做错了什么?

redirect指令不采用正则expression式。 你可能想使用的是RedirectMatch 。

你可以使用mod_rewrite

像这样的东西:

 RewriteEngine on RewriteRule ^/products/(.?)/(.?)/5702/(.*).html http://mycompany.com/footwear/wolverine-boots-waterproof-durashocks-work-boots-2582-33390.html [L,R=301] 

你能举出你正试图redirect的结构的例子吗? es:/product/aa/bb/1234/aaaaaaaaaaa.html