How To Properly Handle Web Errors

by Justin on April 10, 2008

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:

1
2
3
4
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.

{ 1 comment… read it below or add one }

jared April 10, 2008 at 1:21 pm

Excellent tips! Thanks for being a good resource!

jared’s last blog post..Viral Marketing is like Beating up Children

Reply

Leave a Comment

CommentLuv badge

Previous post:

Next post: