pg.
pg.

Reputation: 2531

How to make htaccess demand a password on one domain (or IP) but not another

I have a website that works like this:

They all use file that has these lines:

AuthType Basic
AuthName "Password Protected Area"
AuthUserFile /var/www/vhosts/website.com/.htpasswd
Require valid-user

I want to make it so that there is no password required for users looking at the load balancer. How do I accomplish this?

Upvotes: 1

Views: 114

Answers (1)

anubhava
anubhava

Reputation: 785098

Use mod_envif directives:

SetEnvIf Remote_Addr ^(1\.1.\1\.3|1\.1.\1\.4)$ NO_AUTH

AuthType Basic
AuthName "Password Protected Area"
AuthUserFile /var/www/vhosts/website.com/.htpasswd
Require valid-user

Satisfy    any
Order      deny,allow
Deny from  all
Allow from env=NO_AUTH

Upvotes: 1

Related Questions