Apache是否可以选择全局禁用目录列表? (但它仍然允许我使用index.php作为我的主页)
注意:我有很多虚拟主机和子域,什么不是。
答案 0 :(得分:1)
是的,它可能。您应该将选项指令与-Indexes param
一起使用例如,在Centos /etc/httpd/conf/httpd.conf中将目录/ 更新为:
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories).
#
# First, we configure the "default" to be a very restrictive set of
# features.
<Directory />
Options FollowSymLinks -Indexes
AllowOverride None
</Directory>
这样所有子配置都会限制这种限制。
请注意,如果指令 AllowOverride 设置为索引或全部(此效果覆盖.htaccess文件中的参数),则每个子项都可以覆盖此项