Some
web hosts that support custom error
pages provide an easy to use
control panel to help create and
manage customizable error pages.
For those web hosts that do not have
an easy method to create and manage
custom error pages, you still may be
able to setup custom error pages
using a .htaccess file.
Step 1:
Create a plain text file using a
text editor such as Windows Notepad.
Step 2:
Add the following text...
<Files .htaccess>
order allow,deny
deny from all
</Files>
ErrorDocument 404 /home/user/public_html/404.shtml |
Notes:
-
The
first 4 lines prevents people from
viewing your .htaccess file.
- The last line tells Apache to
redirect all 404 errors to the
page /home/user/public_html/404.shtml
Step 3:
Save the file as a plain text
file. Name the file ".htaccess"
Step 4:
Upload the .htaccess file in
ASCII mode to your web space using
an FTP application.
Step 5:
Create a 404.shtml page using
your favorite web page creation
software.
Tips:
-
Don't
automatically redirect to the home
page. This may annoy some
visitors.
-
Show a
friendly error message. Use a more
informal tone. "Oops! This page
must have been deleted or moved."
- Include your site map on the
error page.
- Include
a method for visitors to easily
contact you on the error page such
as a contact form or chat script.
- Capture
the referring page via the
HTTP_REFERER server variable.
Notify webmasters of these sites
that the link is no longer valid.
-
To prevent search
engines from spiddering your error
pages, add the following line
between the <head> and </head>
tags on the error page:
<META NAME="ROBOTS" CONTENT="NOINDEX,
NOFOLLOW">
Step 6:
Upload the 404.html page to the
same location as listed in your .htaccess
file (/home/user/public_html/404.shtml)
Step 7:
Try it out. Go to a page on your
site that does not exist. |