Bearcat Web Design


Custom Error Messages

Important Note: Do NOT edit the .htaccess file if you are using MicroSoft Frontpage! Frontpage uses the .htaccess file, and editing it may cause errors in your configuration.

To begin with, what is .htaccess?
The .htaccess file can be placed in one or more of your /home/username/www/ subdirectories.

When a request for a web page is made, the web server first checks for a .htaccess file. The server begins this check by looking for .htaccess in the root of the current web directory, and on down the directory tree until it reaches the directory where the requested file resides. Since the placement of the .htaccess file determines when it is executed, this fact can be used to restrict access only in certain subdirectories.

Error Documents

There are two main styles of error messages you may encounter. The first is the standard form, which looks something like:

HTTP 404 File Not found
The requested URL was not found on this server.

The second type comes in a variety of forms, but is customized by the webmaster. For example, visit a non-existing page on our own server: http://www.bearcatwebdesign.com/thisfolderdoesnotexist. Whenever a page or folder is called that does exist, the visitor receives that error message.

Such messages are called error documents, and are web pages designed to give a polite explanation for error conditions. These error conditions generate numbers which are used to refer to the appropriate error condition. Some of the most common messages are as follows:

400 Bad syntax
401 Unauthorized
403 Forbidden
404 Not Found
500 Internal Server Error
501 Not Implemented
502 Overloaded
503 Gateway Timeout

How to Customize Error Messages for Your Site

First, create the HTML page you want to use as your error message (e.g. error401.html or error404.html). Upload it to your www directory. Next, go into your .htaccess file. If you do not have one, create a new file in your File Manager named ".htaccess" (without the quotes) and add lines which specify the substitution. Here are three examples of specifying error documents which will be called for a given error condition. Insert them exactly as shown below (with the URLs changed accordingly) with one error document specification per line.

ErrorDocument 401 http://www.yourdomain.com/error401.html
ErrorDocument 403 http://www.yourdomain.com/error403.html
ErrorDocument 404 http://www.yourdomain.com/error404.html

You view our custom error pages for examples on what to say on your error documents. Error 401, Error 403, Error 404, Error 500.



about us | services | portfolio | your site
customers | newsletter | privacy policy | terms & conditions

© 2000 Bearcat Web Design