Recipe 12.3 Generating Directory/Folder Listings
You want to see a directory listing when a directory is requested.
Turn on Options Indexes for the directory in question:
<Directory /www/htdocs/images> Options +Indexes </Directory>
When a URL maps to a directory or folder in the filesystem, Apache will respond to the request in one of three ways:
Enabling directory listings
The real keys to enabling the server's ability to automatically generate a listing of files in a directory are the inclusion of mod_autoindex in the configuration and the Indexes keyword to the Options directive. This can be done either as an absolute form, as in:
Options FollowSymLinks Indexes
or in a selective or relative form such as:
Options -ExecCGI +Indexes
Enabling directory listings should be done with caution. Because of the scope inheritance mechanism, directories farther down the tree will also be affected; and because the server will apply the sequence of rules listed at the beginning of this section in an effort to provide some sort of response, a single missing file can result in the inadvertent exposure of your filesystem's contents.
Disabling directory indexing below an enabled directory
There are essentially two ways to work around this issue and ensure that the indexing applies only to the single directory:
For example, to permit directory indexes for directory /usr/local/htdocs/archives but not any subdirectories, use:
<Directory /usr/local/htdocs/archives> Options +Indexes </Directory> <Directory /usr/local/htdocs/archives/*> Options -Indexes </Directory>