Reputation: 6052
I am trying to deny access to a folder, unless it is on two specific subdomains. Having a bit of a time getting it to work. Here is what I am trying, which works:
RewriteCond %{HTTP_HOST} !^allowed.subdomain.com$
RewriteRule ^(hidden) - [F,L]
When I add the second subdomain it fails to work:
RewriteCond %{HTTP_HOST} !^allowed.subdomain.com$ [OR]
RewriteCond %{HTTP_HOST} !^secondallowed.subdomain.com$
RewriteRule ^(hidden) - [F,L]
So that the hidden
folder is forbidden on all domains, except allowed.subdomain.com
and secondallowed.subdomain.com
Upvotes: 0
Views: 300
Reputation: 6052
RewriteCond %{HTTP_HOST} !^allowed.subdomain.com$
RewriteCond %{HTTP_HOST} !^secondallowed.subdomain.com$
RewriteRule ^(hidden) - [F,L]
This appears to work, if anyone would like to provide a better explanation how the [OR]
operator works here as opposed to removing it, I will accept that answer :)
Upvotes: 0
Reputation: 7476
Try below rule I am assuming subdomain.com
is same for both the subdomains,
RewriteCond %{HTTP_HOST} !^(allowed|secondallowed).subdomain.com$
RewriteRule ^(hidden) - [F,L]
Upvotes: 1