Got a folder at http://myserver/folder/, I have disabled directory browsing for that folder.
But I want to enable directory browsing for the subfolders o开发者_JAVA技巧f http://myserver/folder/
How can I do this??
Thanks.
here's a working simple solution:
<Directory /path/to/docroot/folder>
Options -Indexes
</Directory>
<DirectoryMatch /path/to/docroot/folder/(.)*/>
Options +Indexes
</DirectoryMatch>
If you do not control apache, you can do this in a per-directory basis in your own files adding .htaccess
file in the corresponding directory containing
Options +Indexes
Here is an option that you can use from .htaccess
:
Options +Indexes
RewriteRule ^$ - [F]
You can just change the permissions of the respective folders. However, if you don't want to allow directory browsing at the /folder/ level, they'll need some link or way to get inward to the folders where you do allow browsing.
You can do this with an .htaccess file in each subfolder or at the top of each subfolder hierarchy. http://httpd.apache.org/docs/2.2/mod/core.html#allowoverride ~ assuming apache
Your mileage might vary ...
.htaccess how no effect
neither did
Options +Indexes
but renaming index.html to _index.html display the files and folders in the browser
Another way is, if you have a directory you don't want browseable, create an empty index.html file in it, hopefully apache will pick that up and serve it instead :)
For any directory where you want to have the ability to list the directory, simply navigate there then execute this command:
echo "Options +Indexes" >.htaccess
精彩评论