Welcome to WebmasterWorld Guest from 126.96.36.199 , register , free tools , login , search , pro membership , help , library , announcements , recent posts , open posts Become a Pro Member
Another redirect question Redirect all requests within a folder Birdman
I'm trying to redirect all requests within a folder to an index page of another folder. Also, one particular file in that folder needs to redirect to a specific page(it's mirror in new dir).
This is what I have in my .htaccess now:
redirectPermanent /folder/specific_page.html ht*p://www.domain.com/new_folder/specific_page.html
redirectPermanent /folder ht*p://www.domain.com/new_folder
The specific page redirects okay, but other requests within the folder return 404
Did you try RedirectMatch?
RedirectPermanent /folder/specific_page.html ht*p://www.domain.com/new_folder/specific_page.html RedirectMatch /folder/.* ht*p://www.domain.com/new_folder/ ( Redirect, RedirectPermanent, and RedirectTemp "keep" anything not matched on the left-side path, and append it to the right-side URL, so the page names in /folder are being appended to your /new_folder URL, which is not what you wanted. RedirectMatch works differently - you must specify a back-reference if you want to "keep" any pathname part.)
Excellent, jd. Works perfectly! Now I only have to do that for six more folders:)
Thanks for that speedy reply!
...] httpd.apache.org Birdman
Do I need to specify 301 like this?
Oops, sorry! RedirectPermanent /folder/specific_page.html ht*p://www.domain.com/new_folder/specific_page.html RedirectMatch 301 /folder/.* ht*p://www.domain.com/new_folder/ Jim Birdman
Yep, I just used the server header utility [ webmasterworld.com] and got 302.
Thanks for the help, jd ;)