Peak SBC, LLC  

 

 

USING OR AVOIDING ERROR PAGES
by: Cary Christian

 

It's happened to everyone. You click on a link or type in a URL and get the following message or some variation of it:

"HTTP Error 404

404 Not Found

The Web server cannot find the file or script you asked for. Please check the URL to ensure that the path is correct.

Please contact the server's administrator if this problem persists."


Chances are good that you will give up trying to find the page after receiving this message. You will probably assume the page no longer exists or has been moved and that you will not be able to find it. You could type in variations of the URL or just go to the domain name portion of the URL to search for the page, but more often than not you'll move on to another site and won't think much about it.

But what if it's your site people are looking for when they receive this message? You don't want them to move on! It's a very simple process to help them find what they're looking for without leaving your site. Here's how to do it.


CREATE A CUSTOM ERROR PAGE

First of all, you want to get rid of that ugly standard error page. Create a custom error page that explains the URL your visitor was searching for has moved, been renamed, or no longer exists. Then give them some options. Place a site search form on the page so they can search for the information they were looking for. Put a site map on the page so they can browse the information you provide on your site. Place your normal navigation buttons on this page. Make the page attractive and inviting. Make the visitor want to stay for awhile. Give the visitor options to keep them on your site.


REPLACING THE STANDARD ERROR PAGE

You will need to locate or create a file named ".htaccess" on your web server. If it exists, you are going to open it in a text editor and edit the contents. If it does not exist, you are going to create it and upload it to your web server.

Let's say you named your new custom error page as follows:
http://www.yourdomain.com/oops.htm

Find the .htaccess file, open it and type the following in the first line of the file:

ErrorDocument 404 http://www.yourdomain.com/oops.htm

If you do not find the .htaccess file, simply type the above into a blank text file, save it as .htaccess and upload it to your server. Make sure the file name is .htaccess, not .htaccess.txt or something similar. Some text editors place the .txt at the end of the name automatically. If yours does, simply rename the file after you've saved it.

Once you upload the .htaccess file and your new custom error page to your website, your new page will display anytime someone clicks on a link to a page on your site that no longer exists.

If you do not maintain your own site, explain to your web designer what you want to do and they will be able to do it for you easily.

If you are on a Windows hosting plan using Internet Information Server (IIS) on the Web server, you'll have to email the URL for your custom 404 page to your hosting company and ask them to edit the properties of your site to use that page as your 404 error message. This is because you generally will not have access to IIS where these changes are made using a GUI interface rather than in the .htaccess file.

In fact, if you are uncomfortable editing the .htaccess file for any reason, just create your custom error page and contact your hosting company to let them make the .htaccess changes for you. They should be happy to do so.

You can also create custom error pages for other errors like error 401 - Unauthorized and 403 - Forbidden if you need to. You add them to the .htaccess file in the same manner.


AVOIDING 404 ERRORS

It is preferable that your visitors never reach a 404 error page. If you remove a page from your site or rename a page, it is a good idea to keep the old page in existence and simply cause it to redirect to a page that offers the same or similar information that was offered on the old page.

Almost any type of log analysis software you might use to analyze the traffic you get to your site will also provide you with information on 404 errors. It will tell you what page people were searching for when they received the error. Use this information to create a blank replacement page with the same name and redirect the page to your new page.

Let's assume you used to have a page on your site for a book you used to sell that was named "book1.htm." You found or wrote another book to replace the old one and created a sales page for it named "book2.htm." Create a blank web page named "book1.htm" and use the following HTML code to redirect the visitor to your new "book2.htm" page:

<html>
<head>
<title>redirect</title>
<meta http-equiv="refresh" content="0;
URL=http://www.yourdomain.com/book2.htm">
</head>
<body>
</body>
</html>

When people click a link they find for your old book1 sales page they will automatically be redirected to your new book2 sales page without receiving an error message. You can simply copy and paste the above code into any blank page and change the URL to the page you want to redirect to.

Custom error pages and redirects are very easy precautions to take. Traffic is difficult to come by. It costs you time, money or both to get people to visit your site. So when they do visit, you don't want to give them any reason to go away before they see what you have to offer.



Copyright (c) 2002

 


(c) 2003, 2004, 2013 Peak SBC, LLC.  Copyrights on all articles and books remain with the author.

Contact Information - Phone: (305) 799-3404

Email: webmaster@peakconsultinginc.com