Disable directory indexes on Apache

Posted under » Apache » LAMP Security on 23 August 2013

If you have mod rewrite on then this is the most flexible way in managing directory listing which is inspired by Drupal.

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

After which add the .htaccess file

# Don't show directory listings for URLs which map to a directory.
Options -Indexes

# Follow symbolic links in this directory.
Options +FollowSymLinks

# Set the default handler.
DirectoryIndex index.php

Read more about Mod Rewrite here.

You may also want to read my earlier article on indexing here.
 

web security linux ubuntu python django git Raspberry apache mysql php drupal cake javascript css AWS data