Apache SetEnvIf problem
My .htaccess file has the following:
SetEnvIf Host "^example\.com$" myvar=1 <IfDefine myvar> RewriteRule ^(.*)$ index2.php?q=$1 [L,QSA] </IfDefine> As far as I can tell, this should work correctly. However, "myvar" does not seem to be defined when I visit example.com . I know that I have mod_setenvif.c enabled (I checked with the <IfModule> block).
Any ideas why "myvar" is not defined?
This is a ServerFault question, but in any case: IfDefine does not test environment variables, it checks the configuration parameters that were passed to Apache at startup. For example, if you run
apache2 -D MYVAR then section
<IfDefine MYVAR> ... </IfDefine> will be executed.
I am not sure if there is any Apache configuration directive that acts as a condition for environment variables, for example you are looking for.