httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Justin Pasher <just...@newmediagateway.com>
Subject Re: [users@httpd] mod_rewrite double escaping query strings
Date Wed, 01 Oct 2008 14:49:39 GMT
Tom Evans wrote:
> Hi all.
>
> I'm encountering a problem with using mod_rewrite in httpd 2.2.9 to
> canonicalize the server name. The problem is that the query string seems
> to be double escaped by this process. Here is a sample vhost that
> triggers the issue:
>
> <VirtualHost *:80>
>     ServerName sweetums
>     ServerAlias foofoo
>
>     DocumentRoot /data2/development/www/sweetums
>     <Directory /data2/development/www/sweetums>
>             Order allow,deny
>             Allow from all
>     </Directory>
>
>     RewriteEngine On
>
>     RewriteCond %{HTTP_HOST}  !^sweetums$
>     RewriteRule ^/(.*)        http://sweetums/$1 [R=301,L,QSA]
>
> </VirtualHost>
>
> So, with this configuration, a request for http://foofoo/bar is
> correctly rewritten to http://sweetums/bar , however a request for
> http://foofoo/bar?and=grill%25 would be incorrectly rewritten to
> http://sweetums/bar?and=grill%2525 .
>
> Is there any way to prevent this behaviour, or perhaps a better form of
> host canonicalization? 
>
> Cheers
>
> Tom

Try removing the QSA flag from the RewriteRule. It should only be needed 
when you are modifying the query string (which you are not).

-- 
Justin Pasher

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