Forum Moderators: phranque
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/ ?
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!
Example: the .htaccess is in the /main/ directory
Redirect 302 /main/author.htm [mydomain.com...]