禁用目录浏览 apache 不起作用
Posted
技术标签:
【中文标题】禁用目录浏览 apache 不起作用【英文标题】:Disable directory browsing apache isn't working 【发布时间】:2017-06-04 04:47:33 【问题描述】:我想在 WordPress 中禁用目录浏览。但它不起作用。 请帮我。我已经编辑了 htaccess (Options -Indexes)
这是文件夹 httpd
<Directory "$INSTALL_DIR/www/">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.4/mod/core.html#options
# for more information.
#
Options +Indexes +FollowSymLinks +Multiviews
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# AllowOverride FileInfo AuthConfig Limit
#
AllowOverride all
#
# Controls who can get stuff from this server.
#
# onlineoffline tag - don't remove
Require all granted
</Directory>
<Directory $INSTALL_DIR/www/wp-includes>
Options -Indexes
AllowOverride None
Order allow,deny
</Directory>
【问题讨论】:
你重启你的httpd了吗? 如果我重新启动 apache?答案是肯定的,我重启服务器apache。 【参考方案1】:您的配置文件中存在一些不一致之处。我是这么想的
<Directory $INSTALL_DIR/www/wp-includes>
应该是
<Directory "$INSTALL_DIR/www/wp-includes/">
请注意缺少的 " 引号和 /
还有
AllowOverride all
应该是
AllowOverride All
注意所有的大写A
如果这不能解决您的问题,请告诉我 Apache 的版本,这是 Windows 还是 Linux。
【讨论】:
以上是关于禁用目录浏览 apache 不起作用的主要内容,如果未能解决你的问题,请参考以下文章