.htaccess配置,以允许从某些IP进行访问并通过登录而无需任何人访问.htaccess

乌鸦

我正在尝试为文件夹创建.htaccess文件。来自某些IP的用户和已登录的用户(来自某些组)应该能够访问该文件夹中的所有文件,但.htaccess文件(每个人都不能访问)除外。我只是被困在这里。到目前为止,这是我得到的:

<FILES .htaccess>
order allow,deny
deny from all
</FILES>

Order allow,deny
Deny from all
# Location of users file
AuthUserFile /etc/httpd/conf/.htpasswd
# Location of usergroups file
AuthGroupFile /etc/httpd/conf/.htgroup
# Name of the prompt
AuthName "Enter password"
AuthType Basic
# Required usergroup to access content
Require group group1
# Allow access from IP 1 without login
Allow from xxx.yyy.zzz.www
# Allow access from IP 2 without login
Allow from jjj.kkk.lll.mmm
Satisfy any

Options +Indexes

任何帮助将不胜感激!

乌鸦

(最终)这是可行的解决方案:

<FilesMatch "^(?!\.htaccess).*$">

AuthType Basic
# Name of the prompt
AuthName "Enter user name andd password"
# Users file location
AuthUserFile /etc/httpd/conf/.htpasswd
# Usergroups file location
AuthGroupFile /etc/httpd/conf/.htgroup
# Required group for authentication
Require group group_name

Order deny,allow
Deny from all
# Allow access from this IP without login
Allow from aaa.bbb.ccc.ddd
Satisfy any

</FilesMatch>

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章