我有.htpasswd中的用户和.htaccess中允许的IP我想允许用户/密码(对于不在.htaccss中的IP)或IP来访问(没有auth)。
我使用这些行编辑了httpd中的dir部分但是它要求不在文件中的允许的IP和IP的用户/密码不会被要求进行身份验证。
<Directory xxx>
AllowOverride All
Options Indexes FollowSymLinks
AuthName "Authentication required!"
AuthType Basic
AuthUserFile <my path>/.htpasswd
<RequireAny>
Require ip 127.0.0.1
Require valid-user
</RequireAny>
</Directory>
这些配置对我有用
AllowOverride All
AuthType Basic
AuthName "Authentication Required"
AuthUserFile "/my path/.htpasswd"
Require valid-user
satisfy any
deny from all
allow from x.x.x.x