Apache: Require username/password authentication except from a single IP, host or network

You configured authentication in your Apache configuration that requires username and password but you want a single IP address, host or network to allow access without entering credentials you can use the code below.

To allow a network you can use CIDR notation like this:
Allow from 1.2.3.4/24
This would match 1.2.3.0-255. Simple matching does work as well:
Allow from 1.2.3

<Location />
  AuthType Basic
  AuthName "Secured"
  AuthUserFile /path/to/.htpasswd
  Require valid-user
  Satisfy any
  Deny from all
  Allow from 1.2.3.4
</Location>
Thomas Eisenbarth Over 13 years ago