Forum Moderators: phranque
I am sorry if this subject has already been covered before but I have searched a number of threads and still cannont find what I am looking for.
I am using a ErrorDocument 404 in my htaccess file to redirect a non existent page to a useful page for the user.
This works fine except it gives a 302 Page found and search engines do not remove the URL from their directories.
As I am updating product lines regularly, many pages are deleted on updates and I need to give a 301 on 404 errors.
I am not into scripting and wondered if it can be done as a Redirect permanent / in the htaccess file to cover any 404 error to go to a designated file for the site or a directory error page.
I am sure in the last google shake up this has affected my PR which reduced by 1 as so many pages get directed to, and contain the same information, yet still registered on google and other search engines as the old URL.
Any help on this would be appreciated.
all the best
Ken
Welcome to WebmasterWorld!
Check the ErrorDocument [httpd.apache.org] documentation in Apache core -- You will find that it requires a local URL-path. If you use a canonical URL, you will get a 302 redirect.
Use ErrorDocument /local_path/to/file.html
Not ErrorDocument http://example.com/path/to/file.html
Jim
Also, there's no need to "monitor" this. You can test it right now using the WebmasterWorld server header checker [webmasterworld.com], and note the results of requesting URLs that will trigger particular errors. No need to worry about this for more than a few minutes...
If you're still getting a 302 after correcting the ErrorDocument directives, then the problem is likely to be a mod_rewrite, mod_alias, or script-based redirect in addition to the original ErrorDocument problem.
Jim