Forum Moderators: phranque
I currently have a 404 in my htaccess file which points to my homepage. This is in my root folder and works fine.
I have recently shut down a classifieds section on my site, which was a php script in a directory called "disability-equipment". When I look at Google, there are still loads of links pointing to the disability directory, that I want to point to "disability-directory/index.html".
Can I just put an htaccess file in the "disability-equipment" directory pointing all the url's from google which were for the old links to the new index.html file as well as keeping the original htaccess file in my root folder?
Thanks
Simon
I'm not convinced I have accurately understood your problem, since the title seems to talk about 404s, whereas your post content about redirection.
A .htaccess file in the root of your website will control all subdirectories too, unless you take steps to prevent this happening.
So, you can redirect your old URLs within the htaccess file in the root directory. No need to create another one
You have a few options for how to perform the redirection, perhaps the simplest of which is mod_alias [google.com]:
Redirect Permanent /old-directory/old-file.html http://www.example.com/new-directory/new-file.html
For more advanced redirection techniques you are best advised to make use of mod_rewrite [google.com]
Don't link or redirect to "disability-directory/index.html". Never include the index file filename in a link or redirect.
You can add a new .htaccess file with a new ErrorDocument directive in the respective folder to point to a specific new 404 file in that folder, with the required error message for that particular missing content, however you might just want to set up a set of 301 redirects for any filename in that folder to redirect to the foldername ending in a "/" instead.