httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier>
Subject Re: [users@httpd] Re: Ampersand extends to the left part of regexes with RewriteRule, RedirectMatch and SetEnvIf: is that expected?
Date Fri, 04 Dec 2009 13:07:58 GMT
Francis GALIEGUE wrote:
> On Fri, Dec 4, 2009 at 09:55, Francis GALIEGUE <> wrote:
>> Hello everyone,
>> I've had the request to redirect a particular URI, say /foo or /foo/
>> to The
>> Apache server version is 2.0.52 used on RHEL 4.x. I have tested with
>> 2.2.3 on RHEL 5.x and the behaviour below is the same...
> This has also been tested on the latest Debian stable: the behavior is
> exactly the same. It seems that it is the core Apache regex mechanism
> which is in cause here.
> Now, the question is, is it intended.
First, I believe that one mistake is to include the trailing question 
mark into the URL which you redirect.
The "?" is not actually part of the URI. It is a separator between the 
URI and the query string. So the URI to test is "/foo/", and not "/foo/?".
Second, in "RedirectMatch", "RewriteCond" and "RewriteRule", the 
argument is a regexp, not a string. So when you write "/foo/?$", you 
mean actually : "/foo", possibly followed by "/", followed by the end of 
the string.
If you really wanted to test for a "?", you would have to escape it as "\?".

I do not know if this is the source of your particular problem, but it 
may contribute to the strange results which you are seeing later.

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message