【发布时间】:2016-01-14 16:21:56
【问题描述】:
我们尝试禁用密码保护以供内部使用。因此,我们希望能够向执行此操作的 url 添加一个参数。我们知道知道这个参数的每个人都可以访问该目录。现在我们已经尝试过:
RewriteEngine On
# Do the regex check against the URI here, if match, set the "require_auth" var
RewriteCond %{QUERY_STRING} !^$
RewriteRule (.*auth=mysecurehash.*) $1 [E=require_auth:false]
#Auth stuff
AuthType Basic
AuthUserFile /.htpasswd
AuthName "Enter Username and Password"
# Setup a deny/allow
Order Deny,Allow
# Deny from everyone
Deny from all
# except if either of these are satisfied
Satisfy any
# 1. a valid authenticated user
Require valid-user
# or 2. the "require_auth" var is NOT set
Allow from env=!require_auth
这应该禁用anydir/anfile.any?auth=mysecurehash 的身份验证
但不幸的是它没有。
实际上现在每个人都可以访问 - 无需密码。
我们缺少什么?
【问题讨论】:
-
您是否尝试将顺序更改为“允许,拒绝”?
-
如果我更改,每个人都会被要求输入密码,无论是否设置了
require_auth -
我们仍然无法找到解决此问题的方法。我真的很感激另一个答案。
标签: .htaccess authentication get password-protection