How can I configure Apache to list files in a directory even if an index file is present?
For example, if I have a directory /var/foo
that contains a number of files, and one of those is a directory index (index.html, index.php, etc.), how can I make Apache show the directory listing instead of displaying the contents of index.html, when a user browses to http://example.com/foo/
?
# Directory listing for /var/foo/, mapped to http://example.com/foo/
..
.
code.c
readme.pdf
index.html
I have used the following but I would imagine there's a better way:
Options +Indexes +MultiViews
DirectoryIndex will-never-exist.xyz
You may leave
DirectoryIndex
option empty or just turn offdir_module
module.The DirectoryIndex directive can be limited in scope with a Directory block
This limits the scope to the particular directory rather than your vhost or server etc.