: 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
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?
More posts by @Megan663
2 Comments
Sorted by latest first Latest Oldest Best
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.
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.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.