Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.htaccess htaccess不拒绝对文件的访问_.htaccess_Basic Authentication - Fatal编程技术网

.htaccess htaccess不拒绝对文件的访问

.htaccess htaccess不拒绝对文件的访问,.htaccess,basic-authentication,.htaccess,Basic Authentication,我在目录的根目录下有一个.htaccess文件,如下所示。clients.php文件正在向htgroups文件中不在admins组中的用户授予访问权限 RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://www......com/dts/$1 [R,L] AuthGroupFile /usr/local/..../htgroup AuthType Basic Require group produc

我在目录的根目录下有一个.htaccess文件,如下所示。clients.php文件正在向htgroups文件中不在admins组中的用户授予访问权限

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www......com/dts/$1 [R,L]

AuthGroupFile /usr/local/..../htgroup
AuthType Basic
Require group producers

<Files clients.php>
  Require group admins
</Files>
重新编写引擎打开
重写cond%{SERVER_PORT}80
重写规则^(.*)$https://www......com/dts/$1[R,L]
AuthGroupFile/usr/local/…/htgroup
AuthType Basic
要求组生产者
需要组管理员

它要求用户进行身份验证并加入生产者组(所有管理员也都在生产者组),但它允许不在管理员行的用户打开clients.php文件。

指令的顺序很重要。因为第一个需求是在全球范围内应用的,所以这就是将要使用的需求。您可以尝试切换顺序:

AuthGroupFile /usr/local/..../htgroup
AuthType Basic
<Files clients.php>
  Require group admins
</Files>
Require group producers
AuthGroupFile/usr/local/…/htgroup
AuthType Basic
需要组管理员
要求组生产者
或将其添加为负匹配:

AuthGroupFile /usr/local/..../htgroup
AuthType Basic
<Files clients.php>
  Require group admins
</Files>
<FilesMatch (?<!clients.php)>
  Require group producers
</FilesMatch>
AuthGroupFile/usr/local/…/htgroup
AuthType Basic
需要组管理员