Hello, please sign in or register
You are here: Home

Apache SetEnvIf cant pass variables to IfDefine

This is a bit annoying. I googled but couldn't find anything of help.

IF DOESN'T WORK

Depending of the Host name i wanted to specify another setting.

SetEnvIfNoCase Host "^test" test

<IfDefine test>
	<ifmodule mod_php5.c>
	      php_value auto_append_file "c:/dev/test/append.inc.php"
	</ifmodule>
</IfDefine>

<IfDefine !test>
	<ifmodule mod_php5.c>
	      php_value auto_append_file "c:/dev/live/append.inc.php"
	</ifmodule>
</IfDefine>

I found similar people expecting the same thing from IFDefine. See http://www.usenet-forums.com/apache-web-server/39093-ifdefine-env-rewriterule-redirect-question.html

This was also helpful http://httpd.apache.org/docs/2.0/mod/mod_setenvif.html#setenvif for finding out that parameter for the requested host: i.e. "Host".

Comments

IfDefine is for the Apache thread itself
Hi. I've interpreted IfDefine as "stuff that happens because Apache was started in some fashion", while SetEnvIf is set per request. But why SetEnv and SetEnvIf acts differently, that's just too rich
Created 09/11/11
IFDEFINE only checks passed apache arguments
more here: http://stackoverflow.com/questions/1369023/apache-setenvif-trouble
Created 13/07/12
Title*
Comment

Prove you are not a robot

To prove you are not a robot, please type in the six character code you see in the picture below
Security confirmation codeI can't see this!
Contact
Name*
Email never shown*
Home Page

Author

Andrew Dodson
Since:Feb 2007

Comment | flag

Categories

Bookmark and Share