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

This content is 19 years old. I don't routinely update old blog posts as they are only intended to represent a view at a particular point in time. Please be warned that the information here may be out of date.

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

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.