【发布时间】:2017-04-18 00:38:06
【问题描述】:
我的目标类似于这里提出的问题:
How to remove .htaccess password protection from a subdirectory
.htaccess 文件保护子目录中的所有index.html 文件。我想从此规则中排除特定的子目录。
但是,即使我在所述子目录中创建了 .htaccess 文件,其内容如下:
Require all granted
我仍然被要求从更高目录中的 .htaccess 文件进行身份验证:
DirectoryIndex index.html
<FilesMatch "index.html">
AuthUserFile /etc/users
AuthName "Protected"
AuthGroupFile /dev/null
AuthType Basic
Require valid-user
</FilesMatch>
如何在子目录中覆盖此 FilesMatch 块,以免请求登录?在我的 apache 配置文件中:
<Directory />
Options FollowSymLinks
AllowOverride All
Require all denied
</Directory>
<Directory /usr/share>
AllowOverride All
Require all granted
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
我确实正确设置了AllowOverride。我做错了什么?
【问题讨论】:
标签: apache .htaccess mod-rewrite