How To Properly Handle Web Errors

Posted in Hosting on April 10th, 2008

Justin RainsWelcome! Thank you for visiting!
Follow me at Twitter
Subscribe to my full feed.

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.


Related Posts:



1 Comment »

  1. Gravatar

    Excellent tips! Thanks for being a good resource!

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

    Comment by jared — April 10, 2008 @ 1:21 pm


RSS feed for comments on this post. TrackBack URI



Leave a comment




  • I Share

      Share Feed: Subscribe
  • Recent Visitors

  • Blogroll

  • Cool Stuff