How to disable the Directory listing?

Disable directory listing to secure web hosting content from hackers

To disable the Directory listing for directories you need to create the .htaccess file under the  folder where you want to disable the Directory listing and insert the following code in .htaccess file.

————
Options -Indexes
————

The above line tells the Apache Web Server to disable directory listing within the directory containing this .htaccess file. You can also reverse this to enable directory listings by replacing the minus sign before the text ‘Indexes’ with a plus sign. e.g. ‘Options +Indexes’.

About Anant 376 Articles
Senior technical writer