httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <ogjunk-htt...@yahoo.com>
Subject [users@httpd] mod_rewrite decodes %20 -> 400 bad request
Date Sat, 12 Nov 2005 19:33:51 GMT
Hello,

I'm using mod_rewrite with httpd 1.3.34 and am having some difficulties
with it when the URL that is getting rewritten has spaces (encoded as
%20) in it.  Example:
  http://simpy.com/user/otis/search/foo%20bar

The error I get is "400 bad Request":

Bad Request
Your browser sent a request that this server could not understand.
The request line contained invalid characters following the protocol
string.

My rewrite rule looks like this:

RewriteRule    ^/user/(.*)/search/(.*)$   
/simpy/User.do?username=$1&q=$2 [P,NE]


And what I see in my access_log is:
  ... "GET /simpy/User.do?username=otis&q=foo bar HTTP/1.1" ...
                                          ^^^^^^^

The problem seems to be that space in "foo bar".
I believe I need to tell httpd/rewrite module _not_ to decode the %20
from the original URL.

Does anyone know how I could configure mod_rewrite so that the %20 gets
preserved instead of converted to spaces?

Any help would be greatly appreciated.  I just discovered this problem
on Simpy.com production site.

Thanks,
Otis

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