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?

  • Just for clarification, we are talking about Apache, right? – andol Aug 8 '10 at 17:08
  • Yes I am using Apache – Josh Pennington Aug 8 '10 at 17:24

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


you could use mod_rewrite

with something like:

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

can you give example of structure you are trying to redirect? es: /product/aa/bb/1234/aaaaaaaaaaa.html

  • the first regex block is in the format 23_45_67 (numbers with _ between them) and the second one is a regular int and the third block is a string. – Josh Pennington Aug 8 '10 at 17:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.