Designing effective 404 error documents
|
|
|
From Stevesdomain.net
'HTTP
404 Not Found' reads the title.
'The page cannot be found' reads the heading on the page.
It's
not pretty, or even clever. As web surfers, we have all collided
with 404 error pages, and some endeavor to correct the error, like
checking the URL for stupid mistakes that often happen. If we find
we have not mistyped the URL, we probably close our browser or fly
off to another site, never to return again. As Edgar Allan Poe wrote,
"Nevermore!" This is a major problem for fellow webmasters.
The
thing about default 404 error pages is it often gives only the error
code and a short description, and if you were oblivious to the web
site you were attempting to visit, the page reveals very little
about the site, or a link to the home page so you can start again.
Many webmasters circumvent this issue with what is known as custom
error pages. These are pages that the webmaster creates to his or
her liking, with the company logo intact and any dialog or links
deemed appropriate. Other common error documents include 500 Internal
Server Error, 403 Forbidden and 401 Authorization required.
This
document refers to the most often hit error document on the Internet,
the infamous 404 Page Not Found error. This error occurs when a
user requests a page from a web server that does not physically
exist (the page, that is). The most common culprit is a misspelled
page extension or link, along with deleting a page from the server
without updating any corresponding links to that page. Let us take
a look at creating an effective 404 Page Not Found error document,
and how to keep more visitors happy and, most importantly, coming
back to your site.
THE
SUPPORT FOR CUSTOM ERROR DOCUMENTS
If
your hosting provider runs off of Apache web servers, then all you
need is an .htaccess file within the root directory of your web
site. Windows based web hosting companies, however, will often use
IIS, or Internet Information Server, where .htaccess files are not
supported. Many hosts will offer a control panel, allowing the webmaster
to easily control their web site, modify settings, implement features
any many other tasks. If you are unsure about whether or not your
host runs off of Apache or IIS, check your control panel, if you
have one, for a custom error document option. If your control panel
does not contain the ability to setup error pages, or your host
does not support control panels, consult with your host's technical
support department and inquire about how to set one up. Since custom
error document support through Apache is universal, the following
will detail how to perform this action.
SETTING
UP ERROR DOCUMENTS THROUGH APACHE
We will
be working with a .htaccess file, which is a file that runs in the
background and contains particular options and settings for your web
site, one being custom error document codes and locations.
First,
fire up your FTP program and login to your account through your
host. Then, search for a .htaccess file. If you cannot find
a .htaccess file on your web site, do not fret. .htaccess files
are a snap to create, and we do just that below. |
PLEASE
NOTE
Some web servers will not display files beginning with a period
(.), or dot. Because of this, you will have to search for the
document or manually type the document name, in this case .htaccess,
into the location bar within your FTP program. |
This can
be done with a normal text editor like Notepad. You may use other
editors, like Editplus, Homesite, etc. To create a .htaccess file
with the 404 error document supported, all we need to type is one
simple line of code at the top of the page:
ErrorDocument
404 http://www.yourdomainname.com/custom404page.html
The
above line of code contains three different parts. The first part,
ErrorDocument, states that you are defining a custom page for one
particular error code. The second part, 404, is the actual error
code. The third is the location of the custom 404 page. All you
need to do is change the location of your error document to your
own file on your web server, and you are set. Be sure that the error
document (ie: custom404page.html) is available on your web server.
Save the file as '.htaccess', without the single quotes, of course,
and transfer the file over to your web server, usually in your root
directory.
Pop
quiz. What do you suppose the line would read if you'd like to specify
a 500 Internal Server Error page? Yes, that's right:
ErrorDocument
500 http://www.yourdomainname.com/custom500page.html
DESIGNING
THE ERROR DOCUMENT
Now
that we have the technical discussion out of the way, let's get
into how exactly to effectively design a 404 error document page.
Here are a few tips when furnishing your document:
Keep
the design constant - That is, whatever design your web site supports,
consider keeping that design when building your error document.
This is not mandatory, however. If you have a good reason to stray
from your design, then do so. Otherwise, keep it constant.
Use
attractive dialog - Do not use the word error. Error signifies something
is terribly wrong, and while that may be so, you should give that
information to your visitor in a very friendly way. Instead, consider
writing "Sorry, the page you were looking for is not available
at the moment".
Include
contact information - Obviously, you want to fix the error, so give
the user every opportunity to e-mail you about the error. Some users
will not bother to do so, but you still need to give them the opportunity.
- Keep
the visitor moving -
Often, 404 error pages are like road blocks, or brick walls that
the user cannot pass through. You need to break through the barriers
and allow the visitor to keep traveling through your web site.
If your web site supports a search capability, include a form
on your error document to let them search for the information
they were originally seeking. At the very least, include a link
to your home page.
- Give
them a site map -
When the user clicks upon a page that is no longer available,
or was mistyped by the webmaster, consider adding a link to a
site map page, or include your site map right on your 404 error
document, so the user can get their bearings within your site,
and can locate their desired content quickly and easily.
- Give
them help - List tips on your error document page to help
the visitor diagnose the error. For example, ask them to double
check the URL in their browser's address bar. If it's correct,
politely ask them to e-mail you to report the error. Also suggest
that they visit your home page (or search utility) to find the
information they are after.
- List
some popular links
- Provide the user with a few links to your most popular content
areas of your web site, as it is more likely they were searching
for that content than anything else.
As
you have seen, error documents are more important than you may think.
Merely having a custom error page shows you have put forth effort
on your web site and want to help the user find the information
they need. Error documents are easy to create and adds professionalism
to any web site. |