Reusing Apache Environment variables while using SetEnv

apache-2.2

So I set an apache variable, and i'd like to use the value to set additional variables. This is possible, I tried various methods to get this to work

SetEnv URL_STATIC http://www.static.com

Doesn't work

SetEnv URL_STATIC_MORE %{ENV:URL_STATIC}/path/path

Doesn't work either 🙁

 SetEnv URL_STATIC_MORE ${URL_STATIC}/path/path

Ideally, i'd like URL_STATIC_MORE to be 'http://www.static.com/path/path' when all is said and done.

UPDATE:

The long winded reason i want to do this is to create a set of links that i can use in HTML/SSI. I Don't have php on my server, and that's not under my control.

So, i'd like to be able to use

<a href="<!--#echo var="ONE_VARIABLE_FOR_URL" -->">blah</a>

rather than

<a href="<!--#echo var="ROOT_URL" --><!--#echo var="PATH_URL" -->">blah</a>

Again, I do not have PHP available to me, and I have to do this for thousands of pages, so putting this in te .htaccess makes sense. I also have multiple root urls, so my config will eventually look like:

SetEnv URL_ROOT_CUSTSVC http://customerservice.company.com
SetEnv URL_ROOT_CORPORATE http://corp.company.com
SetEnv URL_ROOT_PRODUCTS http://products.company.com

SetEnv URL_ROOT_CUSTSVC_1 ${URL_ROOT_CUSTSVC}/path/1
SetEnv URL_ROOT_CUSTSVC_2 ${URL_ROOT_CUSTSVC}/path/2
SetEnv URL_ROOT_CUSTSVC_3 ${URL_ROOT_CUSTSVC}/path/3

SetEnv URL_ROOT_CORPORATE_1 ${URL_ROOT_CORPORATE}/path/1
SetEnv URL_ROOT_CORPORATE_2 ${URL_ROOT_CORPORATE}/path/2
SetEnv URL_ROOT_CORPORATE_3 ${URL_ROOT_CORPORATE}/path/3

SetEnv URL_ROOT_PRODUCTS_1 ${URL_ROOT_PRODUCTS}/path/1
SetEnv URL_ROOT_PRODUCTS_2 ${URL_ROOT_PRODUCTS}/path/2
SetEnv URL_ROOT_PRODUCTS_3 ${URL_ROOT_PRODUCTS}/path/3

Best Answer

Environment variables only work with the following Apache modules:

They cannot be called with SetEnv because that is a directive of the mod_env module.

More information: http://httpd.apache.org/docs/2.2/env.html#using