homepage Welcome to WebmasterWorld Guest from 54.196.159.11
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
Regarding .htaccess redirect
Has the .htaccess file to be in the root?
Ulrike




msg:1514916
 8:20 am on May 15, 2001 (gmt 0)

I hope I choose the right forum for my question.

I changed my directory structure and I am moving files. I want to use redirect to make it the change a vit smoother.

Must I place all redirects into the htaccess in the root directory or can I do it locally?

Say, I want to redirect /a/oldfile.htm to /b/c/newfile.php. Can I place a htaccess in /a/ that handles the redirect to /b/c/ ?

 

DaveAtIFG




msg:1514917
 3:23 pm on May 15, 2001 (gmt 0)

Welcome to WmW Ulrike!

An .htaccess file in the root directory of a site is global to the site. An .htaccess file in a subdirectory acts locally within that subdirectory.

I have used an .htaccess within a subdirectory to redirect from /a/b/oldfile.htm to /a/b/newfile.htm and am confident it works. For the scenario you suggest, I suspect you will need to make your redirects in the root. Try it in a subdirectory and move it to the root if need be. And let us know what you learn!

Ulrike




msg:1514918
 6:54 am on May 16, 2001 (gmt 0)

Thank you for answering. I have tested it. The .htaccess file in the subdirectory redirects to another directory fine. I used absolute paths.

Example: the .htaccess is in the /main/ directory

Redirect 302 /main/author.htm [mydomain.com...]

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
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