Hello everyone,
today is about some Apache “trick” to restrict access on your website. It’s using .htpasswd as you may know. A common problem with .htpasswd is to restrict access with a password, the thing is that you don’t want to type a password all the time, who remembers it? We are all so lazy … me first 🙂
So here goes a configuration which gives you the possiblity to bypass the password for a set of allowed IPs, domains, etc …
This configuration can go into an .htaccess or a virtualhost:
<Location /> AuthUserFile /path/to/the/.htpasswd AuthName "Restricted area" AuthType Basic require valid-user Satisfy Any Order allow,deny Allow from 12.12.12.12 </Location>
How does it work?
If your IP is 12.12.12.12 then you won’t be asked for the password, but if you have a different IP, then you have to remember the password !
Voilà 🙂