我的htaccess中有以下内容
AuthType Basic
AuthName "dev"
AuthUserFile "/home/example/.htpasswds/public_html/example/passwd"
Require valid-user
我想允许访问某些文件而无需输入密码。 这些文件的名称与
类似http://example.com/56B2BB34645F8763C7DC8ADEDC34A0BD.txt
http://example.com/94B2AC8513F8791C7DC8AABFE3DDA0AC.txt
以及名称中包含
的任何.txt文件"Comodo DCV"
我试过
AuthType Basic
AuthName "dev"
AuthUserFile "/home/example/.htpasswds/public_html/example/passwd"
<RequireAny>
<RequireAll>
# example to allow access to callbacks directory
#Require expr %{REQUEST_URI} =~ m#^/callbacks/.*#
Require expr %{REQUEST_URI} =~ m#^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
</RequireAll>
Require valid-user
</RequireAny>
但是当我尝试查看txt文件时,我只收到500错误。
我在哪里错了?
答案 0 :(得分:1)
您可以使用这些指令允许某些字段与auth:
一起显示SetEnvIfNoCase Request_URI "^/[A-F0-9]{32}\.txt$|Comodo\ DCV" ALLOWED=TRUE
AuthType Basic
AuthName "dev"
AuthUserFile /home/example/.htpasswds/public_html/example/passwd
Require valid-user
Order deny,allow
deny from all
allow from env=ALLOWED
Satisfy any