If statement using an environment variable
Solution 1:
It's probably not working because you're not telling apache to pass the environment variables using the PassEnv directive.
You need mod_env loaded, and you have to include a stanza such as
PassEnv MY_ENV_VAR
It's fairly well documented in the Apache Manual