8.14.2006

Disabling Directory Listing in Apache

One of the things that sometimes become nasty is that Apache by default lists all the files in the same directory if that directory does not contains the default index page (e.g. index.html, index.htm).

To disable Apache's directory content listing feature, you should configure the Apache Configuration file (httpd.conf that is located in the "conf" directory of the Apache installation directory).

Find the line that includes "Options Indexes" that is couples of lines after the line "" than replace it with "Options -Indexes". After saving the file, restart the Apache Server.

To illustrate, the following codes:

...
#
# This may also be "None", "All", or any combination of "Indexes",
# "Includes", "FollowSymLinks", "ExecCGI", or "MultiViews".
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
Options Indexes FollowSymLinks MultiViews
...


is replaced with:

...
#
# This may also be "None", "All", or any combination of "Indexes",
# "Includes", "FollowSymLinks", "ExecCGI", or "MultiViews".
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
Options -Indexes FollowSymLinks MultiViews
...

Hiç yorum yok: