我想对apache2-webserver(2.2.9(Debian))上的某些文件进行访问控制,具体取决于remote-ip和使用htaccess文件提供的用户名。
规则:
我在下面发布的htaccess文件允许远程用户登录并禁止访问adm.php。不幸的是,localhost用户需要输入密码。为了让本地用户在没有输入密码对话框的情况下访问adm.php,我需要更改什么?
AuthType Basic
Authname "Test-App"
AuthUserFile /etc/web_passwd
Require valid-user
Order Deny,Allow
Allow from 127.0.0.1
Deny from all
Satisfy Any
<Files adm.php>
Order Deny,Allow
Allow from 127.0.0.1
Deny from all
Satisfy all
</Files>
答案 0 :(得分:1)
启用mod_setenvif,然后在$DOCUMENT_ROOT/.htaccess
:
<Files "adm.php">
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
Satisfy all
</Files>
<FilesMatch "(?!^adm\.php)^.*$">
AuthType Basic
Authname "Test-App"
AuthUserFile /etc/web_passwd
Require valid-user
Order deny,allow
Deny from all
Allow from 127.0.0.1
Satisfy any
</FilesMatch>