M3Server Technical Blog FAQ htaccess restrict by IP or password

htaccess restrict by IP or password



I find myself tired of having to answer the pop up authentication box to view my control panel login or other private content.  Most of the time I am at the office so I could just use my IP, however, I do work remote at times as well.   What to do?

Well, you can instruct apache to satisfy either.  Here is a template, just replace with your content:

# start code

AuthUserFile /home/someuser/path/.htpasswd
AuthGroupFile /dev/null
AuthName "login required.."
AuthType Basic
require valid-user
Order allow,deny
Allow from 55.55.55
satisfy any

# end code

The magic takes place with “satisfy any” directive.  If your at one of the listed ips, password authentication is bypassed.

Enjoy and stay secure.

M3Server – web hosting