How To Properly Handle Web Errors

Every once in a while a search engine will index a page and that page may go away. When someone clicks on the link from the search engine and no efforts have been taken to handle the “Page not found” error visitors will hit the back button and move on. There is a way to customize the errors using a file called .htaccess. Within the file one simply adds these lines:

ErrorDocument 400 /error.php?400
ErrorDocument 403 /error.php?403
ErrorDocument 404 /error.php?404
ErrorDocument 500 /error.php?500

What that does is any web errors that are encountered are automatically sent to a page on your site called error.php . This file can be any valid file on your site or even to another site. Chances are great now that your error is properly handled that your visitor will not hit their back button and leave your site. One problem solved! More info on apache http status codes.

This entry was written by and posted on Thursday, April 10th, 2008 and is filed under Hosting.
Tagged as: apache htaccess
Follow any responses to this entry through the RSS 2.0 feed.

One thought on “How To Properly Handle Web Errors

Comments are closed.