How to Customize Your Own 404 File Not Found Page
|
|
Mark Nenadic November 28, 2006
|
Mark Nenadic |
Mark Nenadic is the director and face behind FifteenDegrees-North
http://www.15dn.com , where you will find articles and resources to
help with SEO, marketing and Web design. |
Mark Nenadic
has written 1 articles for WebKnowHow. |
View all articles by Mark Nenadic... |
We’ve all run into them, the dreaded “404 File Not Found” error page.
When you land there, there are a few things that you can do next. On
average, what do you usually do first when you hit one of those pages:
Immediately click your browser’s “back” button so that you can try
somewhere else, try to edit the URL you’re attempting to visit and then
see if you can head back a step and work your way to where you want to
go, or write an email to the web designer of the website to inform them of
the issue that you’ve spotted while navigating their site. Let me guess what your answer was: You click the “back” button on your
web browser. If you’re like the majority of web users, then that’s
precisely what you answered. Most of us don’t even realize that there
are any other options out there than to go back to where we started.
Therefore, it would be awfully nice to be able to help this type of
visitor to get back to your website in case they’ve landed on an old
link or have entered your URL improperly. You can edit and customize
your own 404 File Not Found page so that it gives them the directions
that they need so that they can get back to your site and find what
they want.
Of course, there are a few things that you’ll need to have available to
you if you want to customize that 404 File Not Found page. The first,
and most important, is that you need to have a web host that enables
you to edit that part of your website. Some will, but some will not.
Before getting started, find out from your web host if they will make
that option available to you. To find out, look into your hosting
documentation and see if they mention anywhere the ability to customize
or edit a file named “.htaccess”. If so, it will likely mean that you
are able to customize your 404 File Not Found.
If your web host does permit you to edit the 404 File Not Found, then
you’re ready to get started. The following are the steps that you will
need to follow:
Create/Modify your .htaccess file – this might not always be necessary,
but for some web hosts, it’s required. If you don’t need it, then skip
this step. If your server isn’t an Apache web server, however, you’ll
need to ask your web host what you need to do to have the server serve
your edited file when a file on your domain can’t be found. Otherwise,
you simply need to add the following line to your “.htaccess” file:
ErrorDocument 404 /notfound.html
With that done, you’ll need to create a notfound.html in your main web
directory. This will be what tells the Apache web server that when it
can’t find a file, then it should use that URL.
It only takes one .htaccess file in your main directory to cover your
entire site and all of its sub-directories. However, if you want
specific sub-directories to show their own 404 File Not Found messages,
then you will have to create a separate one in each directory. The
.htaccess file in any directory or subdirectory will override any other
.htaccess files you have in any other directory or subdirectories.
Create the error file – now it’s time to customize your 404 File Not
found page. Let the visitor know that the link is not functioning, but
don’t stop there. Provide the visitor with alternatives. This should
include a link to your main page.If you have a search engine on your
website, this would be the ideal place to put a query box. This will
make your visitor’s experience very simple because now they can simply
type in what they want and they’ll be sent there. If you don’t have a
search engine on your website – or even if you do – you might want to
place a link to your site map, allowing your visitors to easily find
what they want from the list. The point is simply to make sure that
your visitor doesn’t give up on you and head somewhere else. Copyright 2006 Mark Nenadic
|