Internet and WWW Guides

Listable Web Directories

By default, a URL referring to a directory or folder will look for a file by the name index.php, index.html, or index.htm (in that order) and display the contents of that file.
If none of these files exist, then previously the departmental web server would automatically display a list of the contents of that directory. This is no longer the default behaviour. Instead, the server will display an error message.

If it is desirable for the server to show the contents of a particular directory, then this will need to be explicitly configured.

Enabling directory listings

This is done by creating a file .htaccess within the directory to be made listable. This should contain the following entry:

 Options        +Indexes

This file should then be made globally readable ("chmod a+r .htaccess").

If certain files should be omitted from this list, this can be done using .htaccess entries of the form:

 IndexIgnore        secrets.txt
	IndexIgnore	*.old

Note that this does not mean that such files cannot be accessed - simply that they won't appear in the listing. Anyone that knows (or guesses) the appropriate filename, or follows a link to such a hidden file, will be able to retrieve it.

More information about configuring automatic directory listings can be found in the Apache manual