Mobile app version of vmapp.org
Login or Join
Megan663

: Allow directory listing for subdirectories only 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

@Megan663

Posted in: #DirectoryListing #Iis7

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=".">
<system.webServer>
<directoryBrowse enabled="false" />
</system.webServer>
</location>


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?

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Megan663

2 Comments

Sorted by latest first Latest Oldest Best

 

@Kimberly868

Yes if you allowOverride and then add a new web.config file in the folder you want to disable.

So in your parent folder web.config should look like this.

<configuration>
<location path="." allowOverride="True">
<system.webServer>
<directoryBrowse enabled="True" />
</system.webServer>
</location>
<configuration>


In the folders you want to disable directory browse the web.config should look like this.

<configuration>
<location path=".">
<system.webServer>
<directoryBrowse enabled="False" />
</system.webServer>
</location>
<configuration>


For more info check this article.

10% popularity Vote Up Vote Down


 

@Ann8826881

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.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme