Free content for your website or blog
Home About Us Article Writing Most Read Articles Authors Blog Wiki Contact Us
RSS Register Login
Topics
 
Home > Web Design >

Custom error pages

Date Published: 09th January 2005
Bookmark and Share Republish Custom error pages
Author: David Callan RSS Views: N/A PRINT ASK ABOUT THIS ARTICLE
By David Callan
Link Rot is everywhere on the Internet. Link rot is the name often used to refer to broken links on the web, by broken I do of course mean links that don't work.

When someone is trying to access a page on your site and either the page has been moved or the link was misspelled both Internet Explorer and Netscape will display error pages. If this happens that someone will most likely leave altogether and you'll never see him or her again.

You can prevent this happening as a result of broken links and other errors however if you own your own domain name by setting up what's called custom error pages. This way when someone try's to access one of your pages through a broken link they'll be taken to your custom professional looking 404 error page instead of the basic ''page not found'' one. If they try to access a page that is forbidden they'll be taken to your custom professional looking 403 error page instead of the basic "Access Forbidden" page.


On these custom pages you could have a link back to your home page so the visitor could go there and take a look at what your site has to offer.

Custom error pages are simple normal HTML pages and therefore can be created just as easily as the other pages on your site, however getting them to show up is a little more difficult and as mentioned before you must have your own domain name.

Here's what to do:
First off you need to check out the website directory where your index.html file is located for a file called .htaccess. Most of the time you'll find it but sometimes you'll have to create it yourself. If you have it you should look for code similar to below and change it to suit your directory. If the below lines of code aren't there simply add them below everything else. If the .htaccess file isn't there simply create it and then type in the following lines:


ErrorDocument 400 URL/error400.html
ErrorDocument 401 URL/error401.html
ErrorDocument 403 URL/error403.html
ErrorDocument 404 URL/error404.html

Keep each piece of ErrorDocument code on one line with a space on each side of the number 40?. This code is case sensitive so be sure to check the case of the E and D in ErrorDocument before you proceed.

The code in black stays the same all the time, the URL is the address of the directory in which the error page is located and the error40?.html page is the individual error page itself. The individual page can be called anything but for convenience sake it's best to go for a descriptive name like error40?.html

When your done creating a new file make sure to upload it. If you've edited the current one make sure to save it, then be sure to use the CHMOD command through your FTP program or online file manager to set the permissions to 644.


ErrorDocument 404 is the code associated with link rot which we talked about earlier but here's a run down.

400 - Bad Request
401 - Unauthorized
403 - Access Forbidden
404 - Page Not Found

Nearly finished now, but before we are you should test your new error pages by typing in a URL that you know doesn't exist on your server. You should get your custom 404 error page (if your 404 error page works all your error pages should work) ready to bring in the lost visitors that may be out there.

Tags: domain name, html pages, internet explorer, netscape, david callan, htaccess file, access one, internet link, website directory
This article is free for republishing
Source: http://www.articlealley.com/article_848_4.html
About the Author
Article by David Callan. David is an Internet marketing professional and webmaster of http://www.akamarketing.com/webmaster-forums/ webmaster forums. Visit his webmaster forums for the latest discussions on search engines, website authoring and Internet marketing related issues and topics.
Bookmark and Share Republish Custom error pages

Ask a Question About this Article

>> Any limition for people who "on board courier"
>> Visual C ++ runtime error
>> How to create and start a social networking page
>> Customer service for Edible Arrangements. I have ...
Powered by