How to use the setEnv variable in apache?

baklap picture baklap · Sep 3, 2010 · Viewed 66.5k times · Source

I need to set my apache environment to 'foobar'

I know I need to set in in my vhost, but what should I type there and where?

Answer

Richard Fearn picture Richard Fearn · Sep 3, 2010

SetEnv sets a particular variable to some value, so you need something like

SetEnv varname varvalue

If this is for a specific virtual host, and you have access to the Apache configuration files, this would go inside the <VirtualHost> directive for that virtual host.

If you don't have control of the config files, you'll need to put it in a .htaccess file. But for this to work, SetEnv must be allowed in .htaccess files, which is specified using the AllowOverride directive.