htaccess 限制身份验证但文件异常
htaccess restrict authentification but exception on file
我看过其他一些相关帖子,但没有找到任何解决方案。
我需要通过身份验证来限制文件夹,它有效。
但是在这个文件夹中我需要对每个人开放一个文件访问权限,我用了这个但它不起作用:
AuthName "Admins Only"
AuthUserFile /home/dd/.htpasswd
AuthGroupFile /dev/null
AuthType basic
require user AuthorizedUser
Options -Indexes
<Files "admin-ajax.php">
Allow from all
Satisfy all
</Files>
抱歉我的英语不好,感谢您的帮助!
使用 SetEnv 和 Order 指令:
#set variable if uri is "/admin-ajax.php"
SetEnvIf Request_URI ^/folder/admin-ajax\.php noauth=1
#auth
AuthName "Admins Only"
AuthUserFile /home/dd/.htpasswd
AuthGroupFile /dev/null
AuthType basic
require user AuthorizedUser
#Here is where we allow/deny
Order Deny,Allow
Satisfy any
Deny from all
Require user AuthorizedUser
Allow from env=noauth
这将使您无需登录服务器即可访问 admin-ajax.php。
我看过其他一些相关帖子,但没有找到任何解决方案。
我需要通过身份验证来限制文件夹,它有效。 但是在这个文件夹中我需要对每个人开放一个文件访问权限,我用了这个但它不起作用:
AuthName "Admins Only"
AuthUserFile /home/dd/.htpasswd
AuthGroupFile /dev/null
AuthType basic
require user AuthorizedUser
Options -Indexes
<Files "admin-ajax.php">
Allow from all
Satisfy all
</Files>
抱歉我的英语不好,感谢您的帮助!
使用 SetEnv 和 Order 指令:
#set variable if uri is "/admin-ajax.php"
SetEnvIf Request_URI ^/folder/admin-ajax\.php noauth=1
#auth
AuthName "Admins Only"
AuthUserFile /home/dd/.htpasswd
AuthGroupFile /dev/null
AuthType basic
require user AuthorizedUser
#Here is where we allow/deny
Order Deny,Allow
Satisfy any
Deny from all
Require user AuthorizedUser
Allow from env=noauth
这将使您无需登录服务器即可访问 admin-ajax.php。