Here is a real life example to help you find a solution:
If the host starts with "s" or "static", then create the environment variable "STATIC" and set it to "1":
RewriteCond %{HTTP_HOST} (s|static)\.mysite\.com$ RewriteRule (.*) - [QSA,E=STATIC:1]
Then you can search: if my hosts are "static", then if the files are considered "static" (img, etc.), then stop:
RewriteCond %{ENV:STATIC} 1 RewriteRule (.*)\.(pdf|jpg|jpeg|gif|png|ico)$ - [L]
Now, if you want to be sure that a variable does not exist, just check to see if it is empty. Here is my rule immediately after the previous one: it checks to see if the variable is not empty, and if so, then error = 404 (to simulate "not found"):
RewriteCond %{ENV:STATIC} !^$ RewriteRule (.*) /404.php [L]
In your case, if your env is not empty, you are assuming this is true:
RewriteCond %{ENV:IS_MOBILE} !^$ RewriteCond...
In your case, if your env is exactly matches the string " true ", then you are assuming that it is "true":
RewriteCond %{ENV:IS_MOBILE} true RewriteCond...
Hope this helps.
source share