【问题标题】:Override .htaccess filesmatch password protection in subdirectory覆盖子目录中的 .htaccess 文件匹配密码保护
【发布时间】: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


    【解决方案1】:

    在您的subdirectory/.htaccess 中有这两行以防止身份验证:

    Satisfy Any
    Allow from all
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2010-11-28
      • 2013-10-20
      • 1970-01-01
      • 2022-01-07
      • 2014-06-18
      相关资源
      最近更新 更多