KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I've got several sites: example.com , example1.com , and example2.com . All of them point to my server's /public_html folder, which is my Apache root folder. What do I need to add to my .htaccess file to use http authentication only if the user is coming from example2.com ? example.com and example1.com should NOT use authentication. I know I need something like AuthType Basic AuthName "Password Required" AuthUserFile "/path/to/.htpasswd" Require valid-user But I only want to require a password if the user is visiting example2.com . Edit Using an approach suggested in an answer, I have the following in my .htaccess file: SetEnvIfNoCase Host ^(.*)$ testauth <IfDefine testauth> RewriteRule ^(.*)$ index2.php?q=$1 [L,QSA] </IfDefine> I know that the mod_setenvif.c module is enabled (I verified with an <IfModule> block), but it would appear that "testauth" is never getting defined, because my test to verify (redirecting to index2.php) is not executing (whereas it was getting executed in my <IfModule> block). Any ideas why?
Tags (comma-separated)
Save Edits
Cancel