httpd-users mailing list archives

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

> 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 http://www.uskonnonvapaus.fi/apache-bug/3/one%20two
>
> There is per-directory .htaccess that says
>
> RewriteRule ^(.+)$ http://www.uskonnonvapaus.fi/apache-bug/1/foo.php?q=$1 [P]
>
> and this gives $1 only part to first space. However, on
>
> http://www.uskonnonvapaus.fi/apache-bug/2/one%20two
>
> there is
>
> RewriteRule ^(.+)$ http://www.uskonnonvapaus.fi/apache-bug/1/foo.php?q=$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
http://www.elpauer.org
(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: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


Mime
View raw message