Apache disable directory index

When Apache Directory Index is enabled, if you browse to a url that have no index file present, you will see list of all files. This is not good for securiy as hackers can see all files present in the directory.

apache directory index

One way to disable this directory listing is create a file with name index.html or index.php (whatever file name that is specified in Apache DirectoryIndex) with no content.

Another solution is to disable directory indexing for the web site in Apache virtual host configuration, for this, under

Here is an example apache configuration file

Method 2: disable autoindex module

Directory listing is generated by apache module mod_autoindex.

You can disable this module to disable directory listing generation

On Ubuntu/Debian

See Apache

Need help with Linux Server or WordPress? We can help!

Leave a Reply

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