HTAccess IP限制和htpasswd

时间:2010-10-11 17:36:21

标签: .htaccess

如果用户不在某个IP范围内,有没有办法要求使用htpasswd?

编辑:

K我现在有这个

Order Deny,Allow
Deny from all
AuthName "Htacess"
AuthUserFile /var/www/Test/.htpasswd
AuthType Basic
Require valid-user
Allow from 111.111.111.111
Satisfy Any

但它给我一个500错误

2 个答案:

答案 0 :(得分:7)

想出来

AuthName "Htaccess"
AuthUserFile /var/www/test/.htpasswd
AuthType Basic
Satisfy Any
<Limit GET POST>
    Order Deny,Allow
    Deny from all
    Allow from 111.111.111.111
    Require valid-user
</Limit>

答案 1 :(得分:0)

您可以使用.htaccess限制IP范围的访问。您可以将此与.htpasswd的用户结合使用,以提高安全性。

看一下this tutorial概述两者。虽然是单独的,但您可以在同一个.htaccess文件中一起使用它们。

相关问题