Creating Custom HTML Error Page

Linking documents is the concept on which the web was built. The issue that any web designer has experienced is when someone links to the wrong URL on your site. The user will then get the dreaded Error 404 page not found.

It is an error that isn’t uncommon to users on the web and most users will over look it, or try to find the page from your main web site. But how do you get rid of that default error message and use something creative. There are all kinds of creative 404s which will leave a very impressionable impact on your site’s visitors. Believe it or not, creating a custom 404 error is simplier then you would think, just one line in your .htaccess file can solve the entire issue.

If you don’t know what a .htaccess file is that is okay. A .htaccess file basically controls your site’s configuration, and allows you to change settings which may be set somewhere else on the server. Apache’s website states “htaccess files (or “distributed configuration files”) provide a way to make configuration changes on a per-directory basis.”. Your .htaccess file can protect folders via passwords even redirect users to pages that you only want them to see. With .htaccess, you can tell the webserver to redirect users based on error codes, just by adding the following to your .htaccess file.

ErrorDocument ERROR_CODE /path/to/error/page

The only thing you have to do is replace the ERROR_CODE and /path/to/error/page with the correct information. In the case of a 404 error, you would want to replace ERROR_CODE with 404, and /path/to/error/page to something like /errors/404.php. So if a user happens to get a 404 error, they will be directed to http://www.yoursite.com/errors/404.php. (If you would like a full list of error codes visit W3.org (http://www.w3.org/Protocols/HTTP/HTRESP.html). The 4XX errors are the errors that users see most of the time.)

Now that you have users redirecting to a specific page based on the error they get, you can then create a custom 404 error page. Your 404 page can be creative like BlueDaniel (http://bluedaniel.com/404.html) or be something more useful, like a script which tries to find the page based on URL that was sent to web server, or a combination of both. Either way a custom 404 page is better than a generic 404 page generated by the user’s browser.

By using custom error pages, you are telling the user that your site does exist and you care that they find what they were looking for. You are also showing a professional aspect of design, by not over looking the small things. Adding custom error pages is a great way to “increase” traffic to your site, since you are telling them that the site they are trying to visit is still there, just that the page may be wrong. Another benefit is that search engines now have something to index your site’s error message on rather than something generic.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>