Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What Apache directive would be appropriate to prevent browsers and spiders from exploring css, image and js directories on an Apache web server?

I found this in the http.con file, but it is not doing what I thought it was supposed to do:

 <Directory "/var/www/html/myhome/js">
  Options -Indexes
  Order allow,deny
  Allow from all
share|improve this question
up vote 1 down vote accepted

-Indexes means it will prevent directory listing, so if someone just enter

will not see ALL files in that folder. If you set it properly in httpd.conf, it should work.

Also you can put a simple blank index.html in each folder. Then again your all js files will not be listed.

If you want search engines do not index files in those directories, you have to add that directory in robots.txt disallowed urls list.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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