Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

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

I am using webspace hosted on IIS 7.5 (according to phpinfo() ). Currently, I am enabling directory listings for a directory and all its subdirectories by placing a web.config like

<location path=".">
      <directoryBrowse enabled="false" />

in it. Is there a way to disable the directory listing in the directory itself but enable it for all its subdirectories without placing a web.config in each subdirectory or listing all subdirectories here?

share|improve this question
up vote 2 down vote accepted

If this works in a similar way to Apache, then you could simply create an index.php file (or whatever your directory index file is) in the directory that you don't want to see a directory listing.

share|improve this answer
Of course, that would work, thank you! – Jens May 11 '12 at 18:59

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.