Preventing listing the contents of a directory on an Apache web server

When no default document is found on a web server, depending on the server configuration, users may be able to list the files in a given directory. For Apache servers, this may be prevented on a per-directory basis by adding add an IndexIgnore directive to an .htaccess file.

The syntax is:

IndexIgnore file [file] ...

For example, IndexIgnore * will prevent listing of all files, or alternatively, individual files may be specified.

Full details may be found in the Apache HTTP Server documentation.

Leave a Reply