I need Basic Auth on my website, except if a specific hash is present in the URL.
- www.example.com => Authentication required
- www.example.com/whatever => Authentication required
- www.example.com/whatever?hash=123456 => No Authentication required
AuthUserFile /path/to/.htpasswd
AuthType Basic
AuthName "Dev"
<RequireAny>
<RequireAll>
Require expr %{QUERY_STRING} = 'hash=123456'
</RequireAll>
Require valid-user
</RequireAny>
Basic Auth works, but authentication is required even if hash=123456
is in the URL. What am I doing wrong?
Update
Here is my entire .htaccess
contents.
AuthUserFile /path/to/.htpasswd
AuthType Basic
AuthName "Dev"
Require expr "%{QUERY_STRING} == 'hash=123456'"
Require valid-user
I hit www.example.com/?hash=123456 and it still requires me to authenticate.