On Tuesday 29 May 2012, Richard Davies wrote:
> I'm trying to use the Apache 2.4 ap_expr syntax to write a complex
> test with "RewriteCond expr". My test uses %{REMOTE_USER}.
>
> However, the %{LA-U:REMOTE_USER} look-ahead syntax needed to access
> this variable in a per-server context doesn't seem to work inside
> an ap_expr - I get a parse error.
>
> Can anyone help me understand how to test REMOTE_USER in a
> "RewriteCond expr" test?
In a direct way, the answer is: not yet.
But it should be possible to capture the value with a regex and use it
as backreference $1 in an expr. Something like this (untested):
RewriteCond %{LA-U:REMOTE_USER} ^(.*)$
RewriteCond expr "... $1 ..."
Does this work?
Cheers,
Stefan