I'm using SetEnvIf and Deny to block access to certain countries in my .htaccess.
But I need to exclude certain URLs from this blocking, and thus I'm setting another environment variable for those URLs.
How do I Deny based on a combination of variable 1 and variable 2 ?
SetEnvIf GEOIP_COUNTRY_CODE xx BlockedCountry
SetEnvIf Request_URI "^/important" NeverBlock
In pseudo code I want to do this now:
Deny from env=BlockedCountry && !NeverBlock
From Apache documentation :
Which means you can combine conditions one after the other (there is no "boolean" operators in between).
So in your case, it should look like this
Update
From what you said, it looks like this implies an
OR
condition instead of anAND
(what you want). To do so, you can use this workaroundWith this technique, you set/unset the environment variable depending on the case, which simulates an
AND
condition.