Link to home
Create AccountLog in
Avatar of Rowby Goren
Rowby GorenFlag for United States of America

asked on

htaccess to redirect a number of pages from one domain to another - wildcards?

Hello

I have a number of pages that start with the same words in the file name that I want to redirect to another domain.

Example:

http://www.olddomain.com/fruits-that-taste-good
http://www.olddomain.com/fruits-that-taste-bad
http://www.olddomain.com/fruits-that-taste-sweet
http://www.olddomain.com/fruits-that-taste-sour

I want to do a 301 redirect to the following
http://www.newdomain.com/fruits-that-taste-good
http://www.newomain.com/fruits-that-taste-bad
http://www.newdomain.com/fruits-that-taste-sweet
http://www.newdomain.com/fruits-that-taste-sour


Is there a way to do a rule that will take the wild card "fruits-that-taste-*" and direct all of those to the new domain -- without having to type each page

Something like this (of course I am not using the right syntax:

Redirect 301 http://www.olddomain.com/fruits-that-taste-* http://www.newdomain.com/*

Not sure if this is at all possible.  Looking at my existing htaccess file I see that it is already using RewriteRule for other items.  I read somewhere that RewriteRule is used for more elaborate directs.  So it is available if it helps with this solution.

Thanks!

Rowby
ASKER CERTIFIED SOLUTION
Avatar of duncanb7
duncanb7

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of Rowby Goren

ASKER

Hi Duncak.

Thanks  I will do the test and get back to you later today.

Rowby
Hi Duncan,

Thanks for the answer.  Sorry for the delay in awarding points.

Rowby
Avatar of duncanb7
duncanb7

thanks for your pt,

Have a nice day

Duncan