I did try it before asking this question.
Of course, when you change httpd.conf, you have to restart Apache.
Main Topics
Browse All TopicsI don't want user to browse directory tree in my Web server. How can I configure this in Apache ?
Thanks.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
> I did try it before asking this question.
Well, you didn't say that you already tried it.
The "Indexes" option is what controls the directory browsing. If removing that's
not working for you, you can try one more thing. Try adding the following line in
the Directory section.
DirectoryIndex index.html
> Of course, when you change httpd.conf, you have to restart Apache.
Chill out, dude. It wasn't meant to be condescending.
Directory indexes can be controlled via Options directive -
located either in httpd.conf (access.conf) file or in .htaccess
file.
=== in httpd.conf you're usually setting default for
web server document root or another tree:
<Directory /usr/local/www/data>
Options Indexes FollowSymLinks
AllowOverride All
--- Indexes here means that by default directory browsing would
be enabled; by removing it you would globally disale it on
the server.
If "AllowOverride All" (or "AllowOverride Indexes") is
listed for document root (or other tree) you can adjust
behaviour for subtrees by putting "Options" directive
into .htaccess files in the directory you want to update
(i.e. enable Indexes when they're globally disabled or
vice versa), for example (.htaccess):
Options Indexes
You can protect your directories in two ways. You can use
.htaccess file to protect or using httpd.config file. You
cannot protect a webserver with any other methods.
Option 1: Protect the directory tree with username/password
with .htaccess
--------------------------
In this method to protect a directory tree (with
username/password or IP mask) follow the steps below:
Steps for putting a .htaccess file in the given
subdirectory.
Step 1) Using a text editor (notepad NOT wordpad) copy the
following lines:
order allow,deny
allow from all
require valid-user
Authname DirectoryName
AuthPAM_Enabled off
Authtype Basic
AuthUserFile /path/to/your/.htpasswd
Step 2) Change DirectoryName to any descriptive name for
your password protected directory. Change
/path/to/your/.htpasswd to the path to your
.htpasswd file.
If you do not know what an .htpasswd file is use
/home/sites/www.domain-nam
www.domain-name with your actual domain name.
Step 3) Upload this file to the directory you want password
protected. The file MUST be uploaded in ASCII mode.
The file must be named .htaccess
Step 4) Telnet to the server
Step 5) For the first user you allow access to the
directory use the following command replacing
username with the actual name and www.domain-name
with your domain name.
/usr/sbin/htpasswd -c /home/sites/www.domain-nam
username
The server will promt for a password which must be
entered twice.
Step 6) For each additional user you allow access to the
directory enter the following command:
/usr/sbin/htpasswd /home/sites/www.domain-nam
username
Option 2: Protect the directory tree with with httpd.conf
--------------------------
Using this method, you can protect a directory centrally
without using .htaccess files distributed through the file
system.
Put directories in your httpd.conf file that would protect
the tree. You use basically the same directives you would
in a .htaccess file, but put them inside a directory block
as below:
<directory /htdocs/protected>
... contents of your htaccess file
</directory>
Sample:
<directory /ccuu/protected>
AuthName "restricted stuff"
AuthType Basic
AuthUserFile "c:/program files/apache/conf/user01"
require user myuser
</directory>
Try c:/ccuu/protected if you are using in Windows NT since
it needs to be absoulute path. Not the relative path.
If you want to avoid having someone override your
permissions with a .htaccess file. You might want to
include "allowoverride none" with your other directory
directives here.
BTW: Anything you could do with .htaccess files could be
done in the conf file. The benefit of using .htaccess is
you don't have to restart the server or have access to
the conf files to make changes in permissions to a
particular directory. The drawback is the server has to
read your .htaccess file everytime someone tries to read
from that directory. You gain flexiblity, but lose some
performance.
Option 3:
Another workaround could be to use temporary directories
that have random names and only exist for as long as the
user is browsing your site.
Business Accounts
Answer for Membership
by: prakashkPosted on 2001-05-08 at 13:05:46ID: 6060574
Look for <Directory ....> section in your httpd.conf file. Within that section, look for
the line that begins with "Options". If you have "Indexes" in that line, remove it.
This will remove directory browsing for the specified directory.
You may want to repeat this for all the Directory sections that you want.
Restart Apache.