How do you use SetEnv to read variables in Apache?

Solution 1:

SetEnv is a directive for mod_env, and mod_env doesn't support %{ENV:var} -- only mod_rewrite does this. Don't forget that apache is modular, and modules define their own directives. You can do this with mod_rewrite like this:

 RewriteRule .* -  [E=PROJECT_BASE:%{ENV:DOC_ROOT}]
  ... etc

I must ask, what are you really trying to do? There must be a better way. I can't think of any reason to define your LAYOUT_HOME variable in apache instead of php.