You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Mike Cardwell <ap...@lists.grepular.com> on 2008/01/04 12:22:02 UTC

[users@httpd] mod_rewrite 'B' flag

Hi!

On http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html, an option is 
described:

======================================================================
'B' (escape backreferences)

Apache has to unescape URLs before mapping them, so backreferences will 
be unescaped at the time they are applied. Using the B flag, 
non-alphanumeric characters in backreferences will be escaped. For 
example, consider the rule:

RewriteRule ^(.*)$ index.php?show=$1

This will map /C++ to index.php?show=C++. But it will also map /C%2b%2b 
to index.php?show=C++, because the %2b has been unescaped. With the B 
flag, it will instead map to index.php?show=>/C%2b%2b.

This escaping is particularly necessary in a proxy situation, when the 
backend may break if presented with an unescaped URL.
======================================================================

Before I upgrade, can someone confirm that this option will do what I 
expect it to do? Given a request for: "/Hello/One%2FTwo%2FThree/World/" 
with "AllowEncodedSlashes" turned on.

1.) Without the 'B' flag: "RewriteRule ^(.*)$ http://domain$1 [P]" 
proxies the request to: "http://domain/Hello/One/Two/Three/World/"

2.) *With* the 'B' flag: RewriteRule ^(.*)$ http://domain$1 [P,B] will 
proxy the request to: "http://domain/Hello/One%2FTwo%2FThree/World/"

Is that correct, or have I misunderstood?

Also, am I correct in thinking this option isn't included in the latest 
stable 2.2 release and will be released with 2.2.7? I only ask because I 
found it mentioned at 
http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/CHANGES?view=diff&r1=589614&r2=589615&pathrev=589615

If this *is* the case, why is it already mentioned in the online 
documentation?

Regards,
Mike

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org