How To Disable Apache Directory Listing

In your httpd.conf file you should have something like this:


Options Indexes FollowSymLinks
bla bla bla

To disable directory listing for that directory REMOVE the ‘Indexes’
option. Also, you can use ‘-Indexes’ for that and, sure, you can make a
new entry for a specific directory

OR

One of the “must do’s” on setting a secure apache webserver environment is to disable directory browsing. As a default Apache will be compiled with this option enabled, but its always a good idea to get rid of this setting unless its really necessary. If you have some basic knowledge of vi editor follow this steps

If you are on an RPM installation of Apache (which i dont really recommend) you will find the apache configuration file probably here:

/etc/httpd/conf/httpd.conf

If you are using apache from the source tar balls ( like real men ) probably you will find the configuration file here:

/usr/local/apache/conf/httpd.conf

Using an editor like vi , edit the httpd.conf file and scroll until you find a line like this:

Options All Indexes FollowSymLinks MultiViews

To disable directory browsing carefully remove the line that says: Indexes and leave the line like this:

Options All FollowSymLinks MultiViews

Restart your apache webserver and thats all.

Related posts:

  1. How to disable modsecurity (mod_security) ModSecurity is an open source embeddable web application firewall, or...
  2. Use this script to reduce apache high load This script can be used to minimise the load on...
  3. Apache (httpd.conf) Directives A Quick Look ServerType standalone The option ServerType specifies how Apache should run...
  4. Cannot restart Apache : Segmentation fault : Apache Down Apache goes down and wont come up if we try...
  5. Sample Apache Virtual Host Entry A sample Apache Virtual Host Entry for your reference. vi...