[an error occurred while processing this directive]

| [an error occurred while processing this directive] |
An Introduction to the .htaccess File submitted by Steve Thompson Increase Flexibility With Distributed Configuration Files by Steve Thompson The .htaccess file, or "distributed configuration file," allows Webmasters to configure changes on a per-directory basis. This simple ASCII file contains several lines of configurations that, when placed in a particular directory, apply to all sub-directories. This file gives Web publishers who do not have root server access an alternative to make specific server changes. The odd naming convention ".htaccess" denotes a file extension name for a file with no name. Configurations There are many powerful settings you can change on your server using .htaccess files. Creating the .htaccess file is simple. Open a text editor and save the new document as ".htaccess" (notice the quotations) in a test directory on your Web server. The quotation marks are necessary when saving the file to ensure that no extension is added to the file. Remember you can create as many .htaccess files as you want. Each one can have its own configurations specific for each directory. You must upload .htaccess files in ASCII mode, not binary. You may need to CHMOD the .htaccess file to 644 or (RW-R--R--). This makes the file usable by the server, but prevents it from being read by a browser (which can seriously compromise your security). In most cases, your host will allow .htaccess file support because it saves them a lot of work. Custom Error Pages Instead of having the default 404 Page Not Found, you can customize your own error message with a few lines of code in your .htaccess file. You can use custom error pages for any error as long as you know its number. Example: Password Protection One of the most common uses of the .htaccess file is protection of a specific directory. This is done by requiring the viewer to type in a user name and password to view the document. First, put the following lines of code in the .htaccess file: Example: Redirects The .htaccess file enables you to point old links to new locations. Example: There are several other configurations that are allowed in the .htaccess file including: • Allow/deny IP addresses • Parse PHP in .html files • Allow SSI in .html files • Add new MIME types • Rewriting the URL The power of this small file can be large. It can present opportunities to build a more complex Web site and increase security. |