禁止遍历目录是web服务的基本操作,示例代码:

Options -Indexes FollowSymLinks
<VirtualHost *>
<Directory "../vhosts/blog.phpha.com">
Options -Indexes FollowSymLinks # 修改为 -Indexes 即可
</Directory>
ServerAdmin mail@jb51.com
DocumentRoot "../vhosts/blog.phpha.com"
ServerName shopex:80
ServerAlias blog.phpha.com
ErrorLog logs/blog.phpha.com-error_log
</VirtualHost>

或者.htaccess文件加入如下内容:

<Files *>
Options -Indexes
</Files>

以上内容摘录自:
https://blog.csdn.net/li_haijiang/article/details/78326913



Related Posts: Apache禁止遍历目录 :

留言