Avatar of Rowby Goren
Rowby Goren
Flag 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
Apache Web Server

Avatar of undefined
Last Comment
duncanb7

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
duncanb7

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Rowby Goren

ASKER
Hi Duncak.

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

Rowby
Rowby Goren

ASKER
Hi Duncan,

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

Rowby
duncanb7

thanks for your pt,

Have a nice day

Duncan
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy