homepage Welcome to WebmasterWorld Guest from 54.227.171.163
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Hardware and OS Related Technologies / Linux, Unix, and *nix like Operating Systems
Forum Library, Charter, Moderators: bakedjake

Linux, Unix, and *nix like Operating Systems Forum

    
Another redirect question
Redirect all requests within a folder
Birdman

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 386 posted 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

WebmasterWorld Senior Member jdmorgan us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 386 posted 4:03 pm on Jan 25, 2003 (gmt 0)

Birdman,

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.)

Jim

Birdman

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 386 posted 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

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 386 posted 4:24 pm on Jan 25, 2003 (gmt 0)

Do I need to specify 301 like this?

[R=301]

jdMorgan

WebmasterWorld Senior Member jdmorgan us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 386 posted 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

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 386 posted 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 ;)

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Hardware and OS Related Technologies / Linux, Unix, and *nix like Operating Systems
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved