Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

Possible Duplicate:
How to restrict the download of all files in a folder?

I haven't uploaded index.html or index.php to my root directory. How can I prevent people from looking at a listing of files in parent directory?

Also, is it possible for people to obtain a list of all the files in the root directory once I upload index.html?

I'm currently using .htaccess and htusers to prompt someone to enter a username and password when they try to access any file in the root directory.

This may sound like a weird request but would it be possible to have them come to the site (without an index.html) and just have them not see the files? All it would say on the page would be the following:

Index of/

Apache Server at mysite.com Port 80

share|improve this question
add comment

marked as duplicate by paulmorriss, John Conde Jun 24 '11 at 11:55

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer

up vote 1 down vote accepted

Try adding this into your Apache configuration (for example, .htaccess file):

Options -Indexes

http://httpd.apache.org/docs/current/mod/core.html#options

Another alternative (which is also may be considered as a bit safer approach) is to put default index file into such folders (the following directive tells Apache to display index.html from that folder if directory was requested):

DirectoryIndex index.html

http://httpd.apache.org/docs/current/mod/mod_dir.html#directoryindex

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.