httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pau Garcia i Quiles <>
Subject Re: [users@httpd] RewriteRule, [P] and space on URL
Date Thu, 10 Jan 2008 22:40:00 GMT
Quoting Jori Mantysalo <>:

> I asked about this two weeks ago. Anyone got ideas? If not, who is
> right person to contact? Maintainer of mod_proxy or mod_rewrite?
> See
> There is per-directory .htaccess that says
> RewriteRule ^(.+)$$1 [P]
> and this gives $1 only part to first space. However, on
> there is
> RewriteRule ^(.+)$$1 [R]
> and it works. So it seems that when using [P] -directive and rewriting
> URL that contains space there is some bug. Or is this only feature, or
> should I do something special to get this working?

What happens if you add [B] to the [P] rule?

 From the mod_rewrite documentation:

'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.

Pau Garcia i Quiles
(Due to my workload, I may need 10 days to answer)

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