Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am trying to fix a lot of errros in our old website regarding 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?

Thanks much

Josh Pennington

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

2 Answers 2

up vote 0 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 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

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

 
discard

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.