web analytics

Use A Custom 404 Page

If you have your own domain name, you can create a custom 404 error page for your visitors. What does this do for you? It can help you retain visitors who may leave if they get the standard “File not found” page. Such a page looks a little like this:

File Not FoundThe requested url /notafile.htm was not found on this server.

That isn’t very appealing to a visitor, and if the person came from another site’s link- that potential visitor may just leave. However, you can make your 404 page much more informative, and provide your visitors with a way to navigate through your site. Instead of a “File Not Found” and not much else, you can send them an error page with a professional appearance.

As an example, click the link below. This will take you to the custom 404 page for this site:

Custom 404 Example

Notice how the page was similar to the other entry pages on the site, with the navigation links and a way back to the front page. This allows the visitor to take a look around, or go to the front page where they can see the details of what the site has to offer.

Now, the creation of the custom page itself isn’t difficult. It is just another HTML file saved with any name you want it to have. To get your custom page to show up on a 404 error requires a little extra work. You will also need to be the one in charge of your web site, and it must be under your own domain name. You will not be able to do this otherwise, because someone else will be in charge of the domain. If you are unsure whether or not you have permission to do this, be sure to ask your web host before you proceed.

To begin, go to the main directory of your web site (where your main page is located) through FTP or Telnet. Look for a file there named .htaccess, it begins with the dot as though it is a long file extension. If you have the file, you will want to edit it. If you do not have the file, create a new text file and save it as “.htaccess”.

If you are creating the file from scratch, simply type the following line into the file, changing the url to the location of your custom page:

ErrorDocument 404 http://www.yoursite.com/custom_page.html

Keep it all on one line, with a space on each side of the number 404. Also, this is case sensitive, so be sure to check the case of the E and D in ErrorDocument before you proceed.

If you already have the file and need to edit it, look for a line like the one above. If it is there, you can just change the url. You may want to ask your web host before doing this, just in case. If you do not have the line, add it in after everything else on its own line.

When you are done, upload your new .htaccess file to the server. Then, be sure to use the CHMOD command through your FTP or telnet program to set the permissions to CHMOD 644.

Also be sure that you have uploaded your custom page to the server, otherwise you’ll get a 500 server error or something similar. Once that is done, you can test your new error page by typing in a url that you know does not exist on your server. You should get your custom page, ready to bring in the lost visitors that may be out there.

Article Source: http://www.pageresource.com/zine/custom404.htm


  1. For example the body tag for your About Page looks like this assuming youve already enabled the Thesis option to Use custom stylesheet ..body class custom about..So for example if you wanted the h1 tag on your About page to be red without affecting the same tag when it appears on other pages of your site you could use this in your custom.css file …custom.about h1 . Note CSS class names cannot begin with numbers! .You can then specify styles for that particular class name in your custom.css file similar to the example shown above for the About Page.. Note that you can also use this same field on the Edit page panel but doing so will replace the default class Thesis already assigns to the body tag with whatever class youve designated instead. ………………………..