You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Jori Mantysalo <Jo...@uta.fi> on 2008/01/10 21:46:11 UTC

[users@httpd] RewriteRule, [P] and space on URL

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?

-- 
Jori Mäntysalo

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


Re: [users@httpd] RewriteRule, [P] and space on URL

Posted by Nick Kew <ni...@webthing.com>.
On Sun, 13 Jan 2008 12:37:54 +0000
Mike Cardwell <ap...@lists.grepular.com> wrote:

> > [B] was new in 2.2.7.
> 
> 2.2.6 is the latest version I can find on 
> http://httpd.apache.org/download.cgi, which makes me wonder why the 
> documentation includes stuff that doesn't even exist in a stable
> release yet...

The documentation for your version (whatever that is) is included
in the download and build of your version.  If you or your sysop
haven't removed it, go to http://localhost/manual/

The documentation at apache.org gets updated as and when the
software itself is updated.

-- 
Nick Kew

Application Development with Apache - the Apache Modules Book
http://www.apachetutor.org/

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


Re: [users@httpd] RewriteRule, [P] and space on URL

Posted by Mike Cardwell <ap...@lists.grepular.com>.
Nick Kew wrote:

>>>> 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
>>> What happens if you add [B] to the [P] rule?
>> Internal Server Error, and on error_log
> 
> [B] was new in 2.2.7.

2.2.6 is the latest version I can find on 
http://httpd.apache.org/download.cgi, which makes me wonder why the 
documentation includes stuff that doesn't even exist in a stable release 
yet...

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


Re: [users@httpd] RewriteRule, [P] and space on URL

Posted by Jori Mantysalo <Jo...@uta.fi>.
On Fri, 11 Jan 2008, Nick Kew wrote:

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

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

>> Internal Server Error

> [B] was new in 2.2.7.

Duh. Debian has only 2.2.6 even in unstable.

> Your problem is one I've seen described before, but I don't
> recollect the outcome.  Maybe google would know.

I have googled and found that others have same problem. However I have not 
found just right solution - only workarounds like "use underscore and not 
space" etc.

-- 
Jori Mäntysalo

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


Re: [users@httpd] RewriteRule, [P] and space on URL

Posted by Nick Kew <ni...@webthing.com>.
On Fri, 11 Jan 2008 12:03:22 +0200 (EET)
Jori Mantysalo <Jo...@uta.fi> wrote:

> On Thu, 10 Jan 2008, Pau Garcia i Quiles wrote:
> 
> >> 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
> 
> > What happens if you add [B] to the [P] rule?
> 
> Internal Server Error, and on error_log

[B] was new in 2.2.7.

> . . . /uv/apache-bug/4/.htaccess: RewriteRule: unknown flag 'B'"

And using RewriteRules from .htaccess is insanely complicated!

Your problem is one I've seen described before, but I don't
recollect the outcome.  Maybe google would know.

-- 
Nick Kew

Application Development with Apache - the Apache Modules Book
http://www.apachetutor.org/

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


Re: [users@httpd] RewriteRule, [P] and space on URL

Posted by Jori Mantysalo <Jo...@uta.fi>.
On Thu, 10 Jan 2008, Pau Garcia i Quiles wrote:

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

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

Internal Server Error, and on error_log

. . . /uv/apache-bug/4/.htaccess: RewriteRule: unknown flag 'B'"

-- 
Jori Mäntysalo

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


Re: [users@httpd] RewriteRule, [P] and space on URL

Posted by Pau Garcia i Quiles <pg...@elpauer.org>.
Quoting Jori Mantysalo <Jo...@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