Disable directory listing on apache; but access to individual files should be allowed Disable directory listing on apache; but access to individual files should be allowed apache apache

Disable directory listing on apache; but access to individual files should be allowed


If you are using Debian/Ubuntu, just go to terminal and type

sudo a2dismod autoindexsudo service apache2 restart

If you are using Centos/Fedora, just do:

mv /etc/httpd/conf.d/autoindex.conf /etc/httpd/conf.d/autoindex.bkp/etc/init.d/httpd restart

And similarly in other OS or distros...

This should disable the apache module that makes those fancy (normally useless and a security problem) directory listings. Also, as a bonus, you earn a bit of performance :-)


I really couldnt find a direct answer on internet ; even on apache documentation. Finally, could find the solution through few iterations; we need to use Options and the value should NOT contain Indexes.

<Directory "/usr/share/uploads">        Options Includes FollowSymLinks MultiViews        AllowOverride None         Order allow,deny      Allow from all   </Directory>


The @Deepak solution did not worked for me. This one did:

In the main apace configuration /etc/apache2/httpd.conf just add:

<Directory />        Options FollowSymLinks        AllowOverride All</Directory>

And it will work for all of you domains and subdomains. Without .htaccess file.