Using .htaccess

The .htaccess file is a script that allows a more granular control to pages and data that reside on your server.

Two examples of the .htaccess scripts power.
• Create custom error pages
• Enable .htm, .html pages to be able to handle Server Side Include (as opposed to just *.shml, and *.shtm)

1. Create Custom Error Pages

We'll start with the most common use for this file, creating custom error pages. Your first step will be to actually design the custom error pages for your web site. These error pages should have the same look and feel as your overall web site, while informing the visitor that they are experiencing an error.

The most common error pages are 404, 401 and 500. You aren't limited to these errors as you can create an error page for each and every error possible.

Open up an ASCII text editor such as windows notepad and starting from the top of your page, key in the following lines:

ErrorDocument 404
ErrorDocument 401
ErrorDocument 500

Replace the URL's above with the error pages you have just created and uploaded. Save it as .htaccess.txt and then upload it to your server. This file is uploaded into the root of your public_html directory. Be sure it is uploaded in ASCII form. After doing that, you should use your ftp client and rename the file to it's proper name which is just .htaccess without the .txt extension.

Now any errors that occur will be directed to the appropriate error page.

2. Enable .htm, .html pages to be parsed for SSI

You can use *.htm and *.html pages with SSI. It will require you to either reopen the .htaccess file or create a new one. Lets add to the original .htaccess file that we create above.

Open your text editor, then open the file that contains your .htaccess commands. Now below the existing lines key the following lines.

AddType text/html .shtml .shtm .html .htm AddHandler server-parsed .shtml .shtm .html .htm

Then save it as .htaccess and upload to the root directory of your public_html in ASCII mode. That's it, now the extensions .html and .htm can be used with SSI.

A         B         C         D         E         F         G        

H         I         J         K         L         M         N        

O         P         Q         R         S         T         U        

V         W         X         Y         Z

Home   |   Business Directory   |   Festivals & Fairs (USA)