Apache禁止遍历目录

禁止遍历目录是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>

 


未经允许不得转载:阿藏博客 » Apache禁止遍历目录