Forum Moderators: phranque

Message Too Old, No Replies

doing 301 redirect on many pages, but not whole directory

         

esllou

1:25 pm on May 30, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If I had a load of pages with url's like this:
domain.com/colour-green/greenproduct.html

and they are now

domain.com/colour-blue/blueproduct.html

how could I use rewrite in .htaccess to do 301 redirects to a whole load of them. Too many for me to list out individually in the .htaccess but there is enough of each URL in common for me to be able to do a mod_rewrite, I think. What is the syntax?

?

gergoe

12:30 am on May 31, 2004 (gmt 0)

10+ Year Member



If all green are blue now, then you can use RewriteRule [httpd.apache.org] with Regular Expressions to redirect all green to blue. But if not all are blue now, then you'll need to use a RewriteMap [httpd.apache.org] which uses text files to convert (parts of) the request url to a new one.
This is rather simple actually, check out the URL Rewriting Guide [httpd.apache.org] for similar examples, or check out some older posts for similar threads.
If you have something already but you need help to get it running/fixed, post it here and we'll help you.