Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Conditional SetEnv in .htaccess?

Tags:

Is it possible to set a SetEnv variable in an .htaccess file differently depending on hostname?

For example, I need my .htaccess file to have the following value:

SetEnv PYRO_ENV production 

On production boxes, and...

SetEnv PYRO_ENV stage 

On staging boxes. The .htaccess file is version controlled, which is the reason I'm looking for a conditional solution.

like image 773
Highway of Life Avatar asked May 23 '12 20:05

Highway of Life


1 Answers

For conditional settings there is SetEnvIf:

SetEnvIf Host ^stage\.example\.com$ PYRO_ENV=stage SetEnvIf Host ^(www\.)?example\.com$ PYRO_ENV=production 
like image 106
Fabian Schmengler Avatar answered Dec 03 '22 12:12

Fabian Schmengler