Website Management – Custom Error Pages

Filed under: Site Management

There are times when entvery site will have errors displayed to their visitors and this is normal even on the best and biggest sites.  There are a variety of reasons that a visitor may see an error but as a webmaster you want to provide your visitor with information that will lead them back to the content that they are looking for.

The first and most common is a 404 Error.
This is when your visitor trys to visit a page that is not available on your site. This often happens when you change your directory structure or permalink rewrite structure for your pages and although it is an Error it does not really represent a problem occurring.

The best way to handle your 404 errors is to add a 404 error page to your root website directory. If you are using CPanel or another website management panel you can review the ways that your host wants this file written but for the most part it is as simple as writing a basic html page and naming it 404.shtml and placing it in your /public_html/ directory. Note that the file is named SHTML because it is a server scripted file.

Other common website errors include:

206 Partial Content
301
Moved permanently (redirect)
400 (Bad request)
401 (Authorization required)
403 (Forbidden)
404 (Wrong page)
500 (Internal server error)

If you read your website logs you should be concerned if you are getting a large number of any errors.

500 (Internal server error)
This is a very important Error because it means that the scripts on your site are not functioning properly. It is very common to get this error when you are first installing Perl or Php Scripts because during the install or writing process you are likely to mistake a location of a file or forget the dreaded ; at the end of a line.

Once you fix the initial install if you check that the script is working well then 500 server errors may be caused by a slow server where your processes are timing out before they are completed. This is very common on shared hosting and for some website scripts there really is no cure but to move to a dedicated server to gain you more power. However for most basic website software your host should be able to handle a decent amount of load if you do not go overboard with plugins and special features.

Remember if you are seeing these errors in your log files then your visitors are seeing them when they load your site. Installing Error Handling Pages will present your customer with specific information and if you desire a way to contact you.

Writing Your Error Handler Files
You should make a html file that looks like the rest of your site but the content area should announce the information they were looking for can not be found or that an error has happened.

The page should have all the basic navigation working so they can get back to the area they just were or get to your home or contact page.

An easy way is to view your website and then copy the pages web source code into a text document. This is important for Shopping Sites and Blogs whos sites are often split up in a template.

You can also include a Search Box.

Some ad companies frown on placing ads on error pages so check with your program guidelines. The reason behind this is some sites make temporary pages to get into search engines and then take them offline generating thousands of error pages just to get clicks. 

Site Maps for Search Engines
If you find your site is having a number of missing or moved page problems you may want to look into generating a Sitemap file that can be read by search engines. View our other Guides on Search Engine Site Maps.