Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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

share|improve this question
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
up vote 1 down vote accepted

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

share|improve this answer

you could use mod_rewrite

with something like:

RewriteEngine  on
RewriteRule ^/products/(.?)/(.?)/5702/(.*).html [L,R=301]

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

share|improve this answer
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 posting your answer, you agree to the privacy policy and terms of service.

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