Forum Moderators: phranque
RewriteRule ^ - [E=foo:bar]
SetEnvIf foo ^ this=%{ENV:foo} The rest of the arguments give the names of variables to set, and optionally values to which they should be set. These take the form of
...
3. varname=value
... the third (form) will set the variable to the literal value given by value.
mod_setenvif (which executes before mod_rewrite)
even if SetEnvIf would take an environment variable as a valueNow, see, that's why we needed phranque ;) In all the times I've read that section of the docs, it never sank in that you can only use environmental variables that were set in mod_setenvif. Assuming for the sake of discussion that Apache is being truthful on this point. My first concern was that it only considers environmental variables for the “attribute” section after looking at every possible aspect of the request and all possible header fields, which seems like it would make the server tired. (It would me.)
a sort of hackThat looks cleaner to me, simply because it's all happening in the same module.
SetEnvIf Request_URI "\.php$" foo=bar
SetEnvIfExpr "%{ENV:foo} =~ /(.+)/" cool=$1
SetEnvIf foo "(.+)" cool=$1
Is there a reason to be concerned with running a ton of expressions?