Q. How can I stop my site from returning the default
404 page not found error?
A. You will need to create a custom error page. Depending
on whether your site is hosted on a UNIX server or an NT server,
follow the steps in the tutorial below.
Never Have a 404 Page Not Found Error Again
Unix or NT server
If your website is hosted on a UNIX server
you can create a 404 error trap yourself that will redirect all
code 404 errors (page not found) to your opening page, just follow
steps 1 and 2 below. If your site is located on an NT
server, instructions to make the necessary changes are available
from the Microsoft
NT workshop. Set the NT 404 error to call a file named 404redirect.html,
then continue to step 2 below. If you are not the administrator
of the NT server you will have to ask someone to make these settings
as they need to be done at the physical server level.
Step 1 - For a UNIX Host only
- Open Notepad and Create a new text file.
- Enter the following one line in it:
ErrorDocument 404 http://www.your_site_name.com/404redirect.html
- Replace your_site_name.com with the actual name of your web
Note: All references must be absolute
- Save this Notepad file as .htaccess
(it starts with a period and has no extension and is enclosed
Note: You must enclose the file name
with quotes or change the Notepad option of Save As Type Text
Documents (*.txt) to All Files before saving a file without an
extension. Save this file in your site's root
directory where your index.html page is located. If you
already have a .htaccess file, add the ErrorDocument line to it.
Step 2 - UNIX or NT Host
In Dreamweaver open a new file. Save it in your root directory
and name it 404redirect.html. Make it as plain and simple as you
can. No fancy banners, colors, or options. You want it to load quickly
as it will only be displayed for 5 seconds before taking the site
visitor to your opening page. Enter the following text (or something
similar to it):
The page you requested is no longer available or has been
If you entered this site by a bookmark, please update your
You will be taken to the site opening page within the next
not click this Link
Highlight the last line of text and create an absolute link to
your opening page. An absolute link is http://www.your_site_name.com/index.html.
This is an absolute reference link to your opening page.
Again: change your_site_name.com to the real name of your
site and dont forget the http://www
and the index.html.
This is just a safety feature to assure that the visitor stays
and if they get tired of waiting the 5 seconds they can click the
link and get going.
Remember: All references made in your
404redirect.html and .htaccess files must be full absolute paths.
of your 404redirect.html page:
<META HTTP-EQUIV = "Refresh" Content = "8; URL =http://your_site_name.com/index.html">
<META name="robots" content="NOINDEX, FOLLOW">
setTimeout("top.location.href = 'http://your_site_name.com/index.html'",5000);
take over at 8 seconds. The use of a script redirect set to activate
before the META redirect should satisfy most search robots better
than a META redirect alone will. Some robots will not index past
a META redirect.
Your .htaccess text file and the 404redirect.html file must be
located in the root directory of your hosted website. This is the
same location where you keep your index.html file.
You will never have a code 404 page not found error again no matter
how many pages you move, change the names of, or just forget to
upload. All 404 page not found errors will be redirected to your
opening page automatically. If you want to eliminate the courtesy
page telling the site visitor to change their bookmark you can enter
the URL for your index.html page directly in the .htaccess file
instead of calling the courtesy 404redirect.html page. I do not
like to do this as it is always nice to inform the visitor why the
page they requested is not displayed before taking them to another
You will not be able to test this redirect on your local machine.
The files you created need to be uploaded to your server's root
directory before they will work.
::back to top::
Introduction to META tags
Additional Reference and Resources
Free Webmaster Help
Big Nose Bird
Oregon State University