Welcome to WebmasterWorld Guest from 54.226.143.14

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Regarding .htaccess redirect

Has the .htaccess file to be in the root?

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

10+ Year Member



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/ ?

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

WebmasterWorld Senior Member 10+ Year Member



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!

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

10+ Year Member



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

 

Featured Threads

Hot Threads This Week

Hot Threads This Month