How to disable directory indexing from apache2 when going to the server’s root?

Edit your apache2 configuration file which normally is on the dir: “/etc/apache2/httpd.conf”.

Add the following or edit if your already have some configurations for the default web server dir (/var/www):

 <Directory /var/www>
   Options -Indexes
   AllowOverride All
   Order allow,deny
   Allow from all
 </Directory>

This will disable the indexing to all the public directories.

Leave a Comment