I need something like this:
SetEnv foo bar.baz
RewriteEngine On
RewriteCond %{HTTP_HOST} ^%{foo}$
RewriteRule ^(.*)$ http://www.foo/$1 [L]
UPD:
I have made as follows:
SetEnv HOSTNAME_ENV testsite
RewriteEngine On
RewriteCond %{HTTP_HOST} ^%{ENV:HOSTNAME_ENV}
RewriteRule ^(.*)$ http://www.%{ENV:HOSTNAME_ENV}/$1 [L,R=301]
But it doesn't work. %{ENV:HOSTNAME_ENV} is not defined.