Create Custom 404 Error Pages

Status
Not open for further replies.

Tightmite10

Beta member
Messages
0
Ok, I have a few articles on my website that I could post here...

Here goes:

---------------------------
Create A Custom 404 Error Page



When you go to most sites, and either click-to or enter a non-existant page, you get that boring "404 Page Not Found" Error. When this happens, some people will either click the "back" button, or enter a new URL. Well don't lose potential visitors to this! I will show you how to create a custom 404 Page. It is very easy to do. You need to be running on an Apache web server, and have access to the .htaccess file.



What and where is the .htaccess file?
The .htaccess is a file that can be included in any directory, and tells the webserver what to do when certain thing happen. For now, we'll include it in the root directory. Note that some free hosts, such as Geocities or Angelfire will not be able to to this trick :-(



How to create and modify your .htaccess
First, bring up your editor - Notepad will work fine - and type the following in:

ErrorDocument 404 path/to/errordoc.html

Replace the "path/to/errordoc.html" with the path to where the page you want your visitors to see when they type an incorrect URL is stored. After you have done this, go to Save As as save it as .htaccess - exactly how its spelled there, with nothing before the period. Upload this file to the root directory of your web server.



What it does
The ErrorDocument tells the server that if it cannot find a particular page, it should display the page specified for the 404 error. All your directories could have .htaccess files - say you wanted a particular error page for a certain directory. You could just place a .htaccess file in that directory, and it would only affect that one. The server always looks in the current directory, then the next level down, and so on, until it finds the .htaccess file (or doesn't find one...)



What should you put?
What should you put on your error document? Well first of all, you'd want to inform your visitor that the page could not be found. This could be in a humorous way (such as mine), or in a serious manner. It should also probably include a link to your homepage, and maybe a few other important pages. If you know that a certain page is frequently misspelled, you might include that page. If you have a search engine for your site, you could also include that. Finally, make it fit in...if you are using a yellow/blue color scheme for your site, you obviously wouldn't want the error page to be a red/orange scheme!
 
Status
Not open for further replies.
Back
Top Bottom