Create a Custom 404 Error Page
As you know if you've spent any time at all surfing the web, sometimes you will see the dreaded 404 error condition. This
often occurs because you've entered an incorrect link (perhaps added a ".html" instead of ".htm" at the end of the file) or
perhaps because a site has been updated recently and some links were broken.
Virtually all web sites (especially free sites) have some generic 404 error page displayed when this occurs. This
error pages is either (a) completely unhelpful to a visitor or more likely (b) is very useful advertising for a web host but
completely useless for helping your users navigate your site.
One excellent reason for choosing a paid host over a free host is that you can generally modify the .htaccess file to
provide a custom 404 error page. (This is an important feature to demand from a paid host - if they don't let you use this
feature, find another host. This is also an excellent reason to choose a host which runs the Apache server software over other
brands. For example, Microsoft's Internet Information Server, IIS for short, does not allow for this capability).
So let's say you create a 404 error page. What do you do with it? It's simple - you help your visitors get back to looking
around your site.
Tell them what happened - An error occurred, specifically a page was requested and not found.
Make sure they understand they are still on your site - Sometimes this is not clear, so be sure you include
your logo and other identifications. In fact, the standard 404 error code often means you will lose that visitor forever
because he will immediately assume the site is abandoned.
Give them some reasons why the error occurred - Most people do not know what "404 error" means. Be sure and
give your visitors some tips as to what might have gone wrong. Perhaps they misspelled the URL or a link was bad?
Help them get back to surfing your site - Give them plenty of ways to navigate back into your site. Ideally,
include your standard navigation menu and perhaps even a search option.
Inject a little humor - A joke or funny picture can help lighten up the mood. Remember, you are presenting an
error - you want to get them to smile so they perhaps continue surfing.
Be sure your page is over 1,024 bytes in size - Some browsers will not display error pages that are smaller
than this.
The most important thing to remember is that an error message is stressful to your visitors. These immediately give the
impression that your site is poorly maintained or perhaps even has been abandoned. You only have a few seconds after the error
occurs to get people back to surfing your site, so you had better use that time wisely.
Another useful thing that you can do is call a special CGI routine at the time the error occurs. How do you do this?
Instead of modifying the .htaccess file to reference an HTML document, make it reference a CGI routine directly (perhaps with
the error code as a parameter). This routine can send an email to you (and perhaps even page you) when an error occurs. This
allows you to quickly handle any errors on your web site.
Don't get too stressed out about 404 errors. Remember that no matter
how well you keep up your site they will occur occasionally. Even if every
single link inside your site is perfect, other people will type or code
the incorrect URLs, thus causing errors. Some search engines have bugs and
reference pages incorrectly and sometimes the web server itself returns
bogus errors.
Google provides a number of tools for the webmaster to validate his
site. You can set up an account and access these at:
http://www.google.com/webmasters/tools
These tools will do all of the link checking and validation that you
can imagine automatically. The drawback is they are based upon the Google
search engine spider, which means you add your site, then you wait a few
weeks while Google gets around to creating the index. The advantage is you
get to see your site exactly the way Google sees it, which is very useful
for debugging your search engine friendliness, as well as finding bad
links.
What can you do to prevent or correct 404 errors?
-
Check the links within your site on a regular basis. Correct any references that are broken.
-
If an external link, say from an article, is incorrect, you can create a redirect page to move
the visitor from the incorrect reference to the correct reference. This is generally a lot easier than attempting to get the
author to correct the reference.
-
Check each and every 404 error that occurs and take steps to correct them.
|