How can I password prompt certain IPs and allow all others free access using Apache?
Posted
by Moak
on Server Fault
See other posts from Server Fault
or by Moak
Published on 2009-06-29T11:39:58Z
Indexed on
2010/03/19
7:01 UTC
Read the original article
Hit count: 318
SOLVED: The idea is that if the visitor comes from China they have to pass a basic authentication. If you have any other IP address you can visit the site without being hassled (including proxies)
//1400 rules....
SetEnvIf Remote_Addr 222.249.128.0/19 china
SetEnvIf Remote_Addr 222.249.160.0/20 china
SetEnvIf Remote_Addr 222.249.176.0/20 china
AuthType Basic
AuthName "Restricted"
AuthUserFile /www/passwd/users
Require valid-user
Order allow,deny
Allow from All
Deny from env=china
Satisfy any
© Server Fault or respective owner