Link to home
Start Free TrialLog in
Avatar of E-Dub
E-DubFlag for United States of America

asked on

RegEx 301 Redirect

I'm trying to set up a 301 redirect in my htaccess page where a certain subfolder and ANYTHING after it will redirect to a specific page.

For example:
I want http://website.com/service-guide/ or http://website.com/service-guide/folder1/  or http://website.com/service-guide/folder1/folder2 to redirect to http://website.com/static-page.

I have been trying to make this work with RegEx but can't figure it out. I'm totally new to RegEx so any help would be greatly appreciated.
Avatar of Anthony Garcia
Anthony Garcia
Flag of United States of America image

I think having a simple redirect should be enough since you are not trying to preserve parameters or anything complicated.
Redirect 301 /service-guide  http://website.com/static-page

Open in new window


Doing it this way should include any subfolder of service-guide.
Avatar of E-Dub

ASKER

That works if it's only "/service-guide" but when there's more than that "/service-guide/folder1/folder2, etc" it throws up a 404 error. Do you have any other suggestions to make it work?
ASKER CERTIFIED SOLUTION
Avatar of Dr. Klahn
Dr. Klahn

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of E-Dub

ASKER

Thank so much!!