httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Cardwell <>
Subject [users@httpd] mod_rewrite 'B' flag
Date Fri, 04 Jan 2008 11:22:02 GMT

On, an option is 

'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

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


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