Disable autoindex in Apache

It is quite annoying and can be a security problem if visitors can see the content of a folder while browsing your site.

I have found three ways of managing this

1. Disabling the module globally

a2dismod autoindex
sudo a2dismod autoindex
if in Debian or Ubuntu

2. Changing it with a line in the .htaccess of the folder

two options:
Options -Indexes
that will show as forbidden


IndexIgnore *
that will show it as empty

3. Modifying the /etc/apache2/sites-enabled/default

where you see:

Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all

Remove “Indexes”

More info here: