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