2

I want set some environment variable like this, eg.:

SetEnv SpecialPath "%{DOCUMENT_ROOT}/dir/"

but if i print SpecialPath in path PHP, eg.:

$_SERVER['SpecialPath'];

the output is

%{DOCUMENT_ROOT}/dir/

the expected output is:

/var/www/dir/

the question is: how concatenate environment variable in htaccess?

env_module is enabled

Simone Nigro
  • 4,374
  • 2
  • 28
  • 63

1 Answers1

4

%{DOCUMENT_ROOT} variable is part of mod-rewrite so You can set env for a document root using SETenv directive, try this mod-rewrite based example :

RewriteEngine on


RewriteRule ^ - [E=SpecialPath:%{DOCUMENT_ROOT}/dir/,L]
Amit Verma
  • 39,545
  • 18
  • 87
  • 107