<If "%{SERVER_NAME} == 'domain.tld'">
Order Deny,Allow
AuthName "Protected access"
AuthType Basic
AuthUserFile /path/to/.htpasswd
Require valid-user
#Allow valid-user
Deny from all
Allow from xx.xx.xx.xx
Satisfy any
</If>