When a directory is requested, Apache may be configured to send a particular file within that directory automatically. This is configured with the DirectoryIndex directive. It can list one or more files that Apache should search for in the directory, with the first existing file being returned to the client. For example:
DirectoryIndex index.html index.htm index.php welcome.html
If no file from the DirectoryIndex directive can be located in the directory, then mod_autoindex can generate a listing of the directory contents. This is turned on and off using the Options directive. For example, to turn on directory listings for a particular directory, you can use:
To prevent directory listings (for security purposes, for example), you should remove the Indexes keyword from every Options directive in your configuration file. Or to prevent them only for a single directory, you can use:
If you would like listings to be enabled, but you want to omit particular files, you can use the IndexIgnore directive. For example, to omit any filename starting with tmp and also the parent directory link (..), you could use:
IndexIgnore tmp* .