Reputation: 5860
From the doc, the %{VAR}
is in expression, ${VAR}
is in the configuration.
But what is the difference between them actually, I saw some configuration file use %{VAR}
in configuration too.
Upvotes: 1
Views: 233
Reputation: 4010
It depends of the context:
In regular configuration, ${VAR}
can be an environment variable inherited by Apache process or, since Apache 2.4, defined by a Define
directive.
But, in values of Rewrite*
directives:
${MapName:LookupKey}
(note the :
to distinguish a variable to a RewriteMap): is intended to dynacially map a value to an other via RewriteMap (like lower case a substring)%{VAR}
designates a predefined variable (see the list under RewriteCond's documentation) used for and only by mod_rewrite.EDIT : I should search first in Apache's documentation:
The values of variables defined with the Define of [new from 2.4] or shell environment variables can be used in configuration file lines using the syntax ${VAR}. If "VAR" is the name of a valid variable, the value of that variable is substituted into that spot in the configuration file line, and processing continues as if that text were found directly in the configuration file. Variables defined with Define take precedence over shell environment variables. If the "VAR" variable is not found, the characters ${VAR} are left unchanged, and a warning is logged. Variable names may not contain colon ":" characters, to avoid clashes with RewriteMap's syntax.
Only shell environment variables defined before the server is started can be used in expansions.
(source)
Upvotes: 1