views:

42

answers:

1

We have several domain name aliases all pointing to the same server and directory (just aliases).

But I'd like to password-protect (htaccess) the site when people come from certain domain names.

Thanks

A: 

You can do this using SetEnvIf and <IfDefine>:

SetEnvIfNoCase Host ^www\.example\.com$ host_a
SetEnvIfNoCase Host ^www\.example\.org$ host_b
SetEnvIfNoCase Host ^www\.example\.net$ host_c

<IfDefine host_a>
    …
</IfDefine>
<IfDefine host_b>
    …
</IfDefine>
<IfDefine host_c>
    …
</IfDefine>
Gumbo