Stop Directory Listings on Apache

By: DN
Posted: December 17, 2004

This tutorial will show you how to stop directory listings on an Apache web server. Removing the directory listings will make your website much more secure. You can stop directory listings by editing a simple file called ".htaccess".

Start a new document is you favorite text and save it as ".htaccess". If you would like to stop directory listings type the following in the text editor.

Options -Indexes

If a file called ".htaccess" already exists in your web root then you will need to edit the current file. Once your ".htaccess" file is upload Apache will no longer show your directory listings.

Alternatively, if you would like to show directory listings type this into you ".htaccess" file.

Options +Indexes

Directory listings can pose as a security threat. Only allow directory listings if you know what you are doing.