禁止Apache显示目录的方法

禁止Apache显示目录的方法

所有配置均针对conf\httpd.conf文件。

默认情况,如果appache指定的根目录没有下面项配置的“index.php index.html index.htm”文件之一,则appache会显示目录及目录下的所有文件:
<IfModule dir_module>
    DirectoryIndex index.php index.html index.htm
</IfModule>

禁止apache显示目录的方法是删除“Options Indexes FollowSymLinks”中的“Indexes”项:
<Directory "C:/Webs">
    Options Indexes FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

修改后:
<Directory "C:/Webs">
    Options FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

原文地址:https://www.cnblogs.com/showker/p/1715618.html