Version 3.0. | Brewing in the kitchen.

Content:


Custom 404 Pages

Posted on the 22 November, 2004. Vote: + 6 - 6

Not strictly Pivot-specific, but still useful.

Author icon. Author: Cissi
Email icon. Email: netizenette@gmail.com
Website icon. Website: don't squeeze my world.

One of the most uninspired pages on the Internet is the standard 404, or error pages informing that an address does not exist. The message is brief and at times is not very helpful. The default error message on Apache servers is this:

Not Found
The requested URL /whereami was not found on this server.

While a nice summary of the page's whereabouts, it doesn't inform the user of where the page might be located, if the page might have been moved, or even if the actual site where the page belongs exists.

The message can be frustrating for both the user and the owner of the site. The user may have stumbled upon the page on a search engine that has not yet detected that the page might have moved. A new user may not understand how to visit the top domain of the page, and may simply give up. The owner would miss out on potential readers of their content.

Internet Explorer offers its own default 404 error page:

The page you are looking for might have been removed, had its name changed, or is temporarily unavailable.

Please try the following:
  • If you typed the page address in the Address bar, make sure that it is
    spelled correctly.

  • Open the home page, and then look for links to the information
    you want.

  • Click the Back button to try another link.

  • Click Search to look for information on the Internet.


It is an improvement on the Apache default by offering solutions to the problem, but the error page is unacceptable for people who own subdomains. The "home page" function only links to the uppermost domain, so if your page is located as http://domain.net/you, then the IE error page assumes your entire subdomain does not exist - even if it actually does.

How would you rectify this problem? Simple - by creating your own 404 error page.

Effective 404 error pages:

According to Jakob Nielsen, who has written an excellent article on 404 error pages, an effective 404 page should possess the following:
  • A simple statement about the error;

  • A list of common causes of the error - typing errors, the page has moved, etc, but without blaming the user;

  • A search form so the user can search for the required information.


Creating a custom 404 page:

1) Code the page as though you are coding any other page. Your custom error page can be based upon your general site design, or you can create a completely different design. It can also be in any extension you wish - .php, .html, .shtml, etc. When you are satisfied with your design, upload it into your main folder - where your index page is located - and call it "404.[extension]".

For instance, if I had created my error page in .html, I would call it "404.html."

2) If you already have a .htaccess file on your server, insert the following code:
ErrorDocument 404 http://www.path.to.your/404.html

Voila! You now have your own customized error page.

3) For those who do not have a .htaccess file, this is how you can create one.

Firstly, open Notepad and insert the code from step 2. Save the file as ".htaccess.txt", and upload it onto your server using a FTP client. Be sure to upload the file in your main folder. Once uploaded, remove the ".txt" extension so it reads ".htaccess".

For more information on error pages, visit these sites:

Custom 404 Pages
Jem's Custom 404 Tutorial
Name:  
Remember personal info?

Email:
URL:
Comment: / Textile

  ( Register your username / Log in )

Notify: Yes, send me email when someone replies.  

Small print: All html tags except <b> and <i> will be removed from your comment. You can make links by just typing the url or mail-address.