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,717
  • 2
  • 37
  • 72

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
  • 40,709
  • 21
  • 93
  • 115