You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by "Neil A. Hillard" <ne...@agustawestland.com> on 2007/11/27 17:09:43 UTC

[users@httpd] mod_rewrite with percent encoded slashes...

Hi,

	I'm encountering an oddity that I can't currently explain.  Hopefully
someone here will know the answer.

I'm trying to improve some URLs and am using the following mod_rewrite
configuration:

 RewriteEngine On
 RewriteRule ^/test!(.*)$ /test.php?a=$1 [PT,L,QSA]

So the following URLs get successfully passed through to test.php:

http://server.domain.co.uk/test!abcd
http://server.domain.co.uk/test!abcd/efgh
http://server.domain.co.uk/test!abcd%20efgh

but the following one does not make it:

http://server.domain.co.uk/test!abcd%2Fefgh

In fact it doesn't even hit mod_rewrite!  I've added RewriteLog and
ewriteLogLevel but nothing's written to the log whereas the other three
URLs result in something like the following in the log file (so I know
the log directives are working):

172.16.0.1 - - [27/Nov/2007:16:06:34 +0000]
[server.domain.co.uk/sid#b820e3f0][rid#b8673b78/initial] (2) init
rewrite engine with requested uri /test!abcd
172.16.0.1 - - [27/Nov/2007:16:06:34 +0000]
[server.domain.co.uk/sid#b820e3f0][rid#b8673b78/initial] (3) applying
pattern '^/test!(.*)' to uri '/test!abcd'
172.16.0.1 - - [27/Nov/2007:16:06:34 +0000]
[server.domain.co.uk/sid#b820e3f0][rid#b8673b78/initial] (2) rewrite
'/test!abcd' -> '/test.php?a=abcd'
172.16.0.1 - - [27/Nov/2007:16:06:34 +0000]
[server.domain.co.uk/sid#b820e3f0][rid#b8673b78/initial] (3) split
uri=/test.php?a=abcd -> uri=/test.php, args=a=abcd
172.16.0.1 - - [27/Nov/2007:16:06:34 +0000]
[server.domain.co.uk/sid#b820e3f0][rid#b8673b78/initial] (2) forcing
'/test.php' to get passed through to next API URI-to-filename handler


Does anyone have any suggestion why a slash that's been converted to %2F
causes the request to miss mod_rewrite (and come back with a 404)?

Many thanks in advance,


				Neil.

-- 
Neil Hillard                    neil.hillard@agustawestland.com
AgustaWestland                  http://www.whl.co.uk/

Disclaimer: This message does not necessarily reflect the
            views of Westland Helicopters Ltd.

---------------------------------------------------------------------
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] mod_rewrite with percent encoded slashes...

Posted by RuiXian BAO <ru...@gmail.com>.
Hello,

On 11/27/07, Neil A. Hillard <ne...@agustawestland.com> wrote:
>
>
> > http://httpd.apache.org/docs/2.2/mod/core.html#allowencodedslashes
> >
> > Magic :-)
>
> You're certainly right - that magic did the trick!



Hmm, I noticed that the problem exists for FireFox. It is okay at least for
IE 6. Perhaps IE 6 does some preprocessing before sending the request.

Best

- RuiXian


Many, many thanks,
>
>
>                                 Neil.
>
> --
> Neil Hillard                    neil.hillard@agustawestland.com
> AgustaWestland                  http://www.whl.co.uk/
>
> Disclaimer: This message does not necessarily reflect the
>             views of Westland Helicopters Ltd.
>
> ---------------------------------------------------------------------
> 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] mod_rewrite with percent encoded slashes...

Posted by "Neil A. Hillard" <ne...@agustawestland.com>.
Vincent,

Vincent Bray wrote:
> On 27/11/2007, Neil A. Hillard <ne...@agustawestland.com> wrote:
>> Does anyone have any suggestion why a slash that's been converted to %2F
>> causes the request to miss mod_rewrite (and come back with a 404)?
> 
> http://httpd.apache.org/docs/2.2/mod/core.html#allowencodedslashes
> 
> Magic :-)

You're certainly right - that magic did the trick!

Many, many thanks,


				Neil.

-- 
Neil Hillard                    neil.hillard@agustawestland.com
AgustaWestland                  http://www.whl.co.uk/

Disclaimer: This message does not necessarily reflect the
            views of Westland Helicopters Ltd.

---------------------------------------------------------------------
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] mod_rewrite with percent encoded slashes...

Posted by Vincent Bray <no...@gmail.com>.
On 27/11/2007, Neil A. Hillard <ne...@agustawestland.com> wrote:
> Does anyone have any suggestion why a slash that's been converted to %2F
> causes the request to miss mod_rewrite (and come back with a 404)?

http://httpd.apache.org/docs/2.2/mod/core.html#allowencodedslashes

Magic :-)

-- 
noodl

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