How to stop people from browsing directories?

Yogesh Sarkar

New Member
Is there a configuration setting to make the directories unbrowseable through http? Currently if a directory doesn't have the index file, people can see the directory content by typing in its address and I want to stop that.
 

rezag

New Member
Other than the index file you mention, via htaccess, by adding

Options -Indexes

I am not much of a httpd.conf expert but I believe 'Options Indexes' may be in it and can be removed but like I said I have never done it (or much) in httpd.conf
 

geetee

New Member
As rezag says...

Adding this line:

Options -Indexes

to the .htaccess file in the root directory of the site should turn off indexing for all directories of that site.

If you want to do it server wide (every site) then you need to add the same line into /etc/httpd/conf/httpd.conf

The section you need to look for should be something like this...

#
# Each directory to which Apache has access, can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories).
#
# First, we configure the "default" to be a very restrictive set of
# permissions.
#
<Directory />
Options All
Options -Indexes
AllowOverride All
</Directory>


Otherwise the user could do it using the cPanel Index Manager (in the Advanced section) on each and every folder.
 
Top