Welcome to WebmasterWorld Guest from 22.214.171.124 , register , free tools , login , search , subscribe , help , library , announcements , recent posts , open posts Pubcon Platinum Sponsor
Another redirect question Redirect all requests within a folder Birdman msg:912270 3:41 pm on Jan 25, 2003 (gmt 0) Hello,
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
jdMorgan msg:912271 4:03 pm on Jan 25, 2003 (gmt 0)
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.)
Birdman msg:912272 4:13 pm on Jan 25, 2003 (gmt 0)
Excellent, jd. Works perfectly! Now I only have to do that for six more folders:)
Thanks for that speedy reply!
...] httpd.apache.org Birdman msg:912273 4:24 pm on Jan 25, 2003 (gmt 0)
Do I need to specify 301 like this?
jdMorgan msg:912274 4:34 pm on Jan 25, 2003 (gmt 0)
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 msg:912275 4:40 pm on Jan 25, 2003 (gmt 0)
Yep, I just used the server header utility [ webmasterworld.com] and got 302.
Thanks for the help, jd ;)