Subfolder directory browsing in Apache2

邮差的信 提交于 2019-12-18 21:27:13

问题


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 of http://myserver/folder/

How can I do this??

Thanks.


回答1:


here's a working simple solution:

<Directory /path/to/docroot/folder>
        Options -Indexes
</Directory>
<DirectoryMatch  /path/to/docroot/folder/(.)*/>
        Options +Indexes
</DirectoryMatch>



回答2:


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



回答3:


Here is an option that you can use from .htaccess:

Options +Indexes
RewriteRule ^$ - [F]



回答4:


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.




回答5:


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




回答6:


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




回答7:


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 :)




回答8:


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


来源:https://stackoverflow.com/questions/6686381/subfolder-directory-browsing-in-apache2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!