Praveen's Blog

An Eternal Quest for Incremental Improvement

Preventing directory listing in Apache

To prevent directory listing in Apache, add the following line to .htaccess in the top level of the directory you want to do it.

Options -Indexes

To allow directory listing for specific subdirectories, you can add the following in the .htaccess of the subdirectory to override the parent directory's default setting.

Options +Indexes

To get this working, you would need override support in the Apache configuration.