Apache Server configuration support - Re: rewrite URL encoded URLs?

This is Interesting: Free IT Magazines  
Home > Archive > Apache Server configuration support > August 2005 > Re: rewrite URL encoded URLs?





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Re: rewrite URL encoded URLs?
Jim Hayter

2005-08-25, 6:06 pm

On Wed, 24 Aug 2005 10:42:03 -0400, in alt.apache.configuration, Jim
Hayter <see.reply.to@nowhere.invalid> wrote:

>On Wed, 24 Aug 2005 11:51:48 +0200, in alt.apache.configuration,
>Daniel Jaenecke <jaenecke@gmx.li> wrote:
>

<snip>[vbcol=seagreen]
>
>I see a lot of these also. I've been contemplating something along
>the lines of:
>
> RewriteCond %{QUERY_STRING} =""
> RewriteRule (.*)%3F(.*) $1?$2 [NC]
>
>I think the above will handle it since the argument parsing routines
>we use should handle encoded argument strings. If not, this would
>require further processing to decode the encoded query string.
>
>One thing I notice is that the URLs like the OP's example seem to come
>from certain search sites. It looks like they are not providing
>regular URLs in their results, but encoded URLs. Is an encoded URL
>something I should expect and deal with or is it an error on the site
>providing the link?
>
>Jim
>


I looked into this some more, trying the RewriteRule w/cond above and
turning on the rewrite log. I found that the URL is decoded
internally but apparently NOT broken up into the two pieces,
REQUEST_URI and QUERY_STRING. The entire decoded URL is in the
REQUEST_URI. I added the following:

RewriteCond %{QUERY_STRING} = ""
RewriteRule (.*)\?(.*) $1?$2

This worked. The \? matched the ? in the REQUEST_URI and by
reconstructing the request, appears to restart the parsing with the
request being split correctly.

Is this how it should work?

Thanks,
Jim
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com