.htaccess Files

The www.washington.edu cluster uses Apache as its web server, and Apache's method to allow per-directory customization is via .htaccess files.

Commands in .htaccess files are inherited by all subdirectories. Because of this, you must be careful that you don't inadvertently change Apache's behavior in directories beneath the one with the.htaccess file. On the other hand, you can use this property to your advantage to limit which files your .htaccess commands affect.

Unless otherwise indicated, these commands are part of Apache and their documentation can be found at:

http://httpd.apache.org/docs/mod/

chtml

You can enable and disable chtml with the following commands:

chtmlUse on
chtmlUse off

This only works on www.washington.edu systems.

Enabling Weblogin and Access Control

If you wish to limit access to pages, the best way is with Weblogin (also known as pubcookie.) There are many different commands you can use to limit access, which can be found in the Weblogin and Access Control page. Some of these commands only work on www.washington.edu hosts.

If you desire an extremely low-security model, you can use what is known as Basic Authentication.

Adding Mime Types

If you have a document with a mime type which is not supported server-wide, or you wish to change the mime type of files which are already set to something else, you can change those commands via a .htaccess file.

Warning: Internet Explorer often ignores the mime type sent back by the server, and overrides that with what it believes to be the correct mime type based on the filename extension. One way you can see this in action is if you have a file with the extension of .html but the server sends, for example, the text/plain mime type, Internet Explorer will (incorrectly, according to the HTTP specification) interpret the file as HTML. Netscape, however, will accept the mime type and display the file as plain text.

Map a Mime Type to and Extension

To add (or change) a file extention to a certain mime type, you use the AddType command. For example, if you wish to change all .txt files to be interpreted as HTML, you would use:

AddType text/html txt

Forcing a Mime Type

If you wish for all files in a directory to be mapped to the same mime type, you use the ForceType. To force all files to be interpreted as HTML, you would use:

ForceType text/html

You might, for example, want to use this command if the files in a directory do not necessarily end with .html.

Enabling Directory Listings

If you wish for Apache to automatically generate a directory listing, you need to explicitly enable that feature. You can do so with:

Options +Indexes

Be very careful that you do not put any unintentional files in this directory.

Headers and Footers

If you wish to have a description of the directory, you can put that text into a file named HEADER, and it will appear before the directory listing. The contents of the file named README will appear after the directory listing.

Adding File Descriptions

To add text descriptions for files, you can use the AddDescription command. As an example, if you wish to make all files which have names containing "153" to be described as "Version 1.5.3" and all files which have names containing "154" to be described as "Version 1.5.4" you would use:

AddDescription "Version 1.5.3" *153*
AddDescription "Version 1.5.4" *154*