Home l Hosting Plans l Services l Portfolio l Graphics I Animation I Contact l FAQ l Support I Special

 
Using .htaccess

The Apache web server utilizes a per-directory access and configuration system. Users can modify operation of their web site by creating ".htaccess" files. We have compiled some of the most useful features for you to use on your site.

Use of a .htaccess File
Follow these steps to create and upload your own .htaccess file.

1. Create a plain text file named ".htaccess". Use notepad or a similar text-only program to do this. Make sure it does not have a ".txt" or any other extension.

2. Enter the lines of code below for the function you wish to use. Lines beginning with a # symbol are just comments and are used for your information only. When the sever reads the file it will ignore these.

3. Place this file in the directory you are wanting to protect. You can upload this using FTP.

Note: You must not attempt to use a .htaccess file if using Microsoft FrontPage extensions as they interfere and cause problems.

Error Documents
Another useful feature of a ".htaccess" file is custom error messages. When a web server encounters an error, either server side or client side, it responds with a three digit error code. For example, 404 - File not Found, 500 - Internal Server Error. Apache provides a means for redirecting these errors to a program, or static page of your choice. You will do this using the "ErrorDocument" directive. To redirect all "Not Found" errors to a static page, and all 500 errors to a PERL script, you would use the following lines.

ErrorDocument 404 http://www.mydomain.com/404.html
ErrorDocument 500 http://www.mydomain.com/cgi-bin/errors.pl?error=500

Directory Index
One of the more useful features of your ".htaccess" files is the ability to change which default document you want to use.

If the first page you want visitors to your site to see is titled "firstpage.pl", then you can instruct the web server to display any pages named "firstpage.pl" before it returns anything else, when your site is accessed in the form of http://www.mydomain.com. To do this, you'll use a "DirectoryIndex" directive, like so:

DirectoryIndex firstpage.pl index.html index.htm

The filenames are listed in order of precedence. In other words, if no firstpage.pl, and index.html exist, the web server will display index.htm as your default page.

 

 

 
     
Home l Hosting Plans l Services l Portfolio l Graphics I Animation I Contact l FAQ l Support I Special

© Interweave Web Design