.htaccess 301 redirect with regex

.htaccessapache-2.2redirectregex

I am trying to fix a lot of errors in our old website regarding a thing with product pages having multiple URLs associated with a single product.

I am hoping that I can use regular expressions in with a regular redirect 301 line but so far I cannot seem to get it to work.

Here is what I am trying:

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

Does anyone have any ideas as to what I am doing wrong?

Best Answer

The redirect directive doesn't take regular expressions. What you probably want to use instead is RedirectMatch.

Related Topic