You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Jonathan Rochkind <ro...@jhu.edu> on 2007/09/19 22:55:37 UTC
[users@httpd] mod_rewrite, query_string, is replacing & with &, it's a problem
So I am trying to use mod_rewrite to rewrite something in my query
string. Apache 2.2.3.
It appears that mod_rewrite or something else will rewrite all "&" in
query string to "&", whenever you do anything with the query string
in mod_rewrite. Even with the [NE] flag. I'm not sure why it's doing
this, and it's highly undesirable to me here, because the request ends
up going to some software that is unhappy with the query string
parameter delimiters being turned into "&".
As an example, let's pretend I want to change 'dog' in the query string
to 'cat'. I try:
RewriteEngine on
RewriteCond %{query_string} ^(.*)dog(.*)$
RewriteRule ^(.*)$ $1?%1cat%2 [NE,R,L]
Let's say the incoming URL is:
/foo?animal=dog&color=blue
What I get out of this is:
/foo?animal=cat&color=blue
So 'dog' has been turned to 'cat' in the query string, good. But all of
the "&" have also been turned to "&". This is a problem for me in my
particular circumstances. I want apache to leave the query string alone
except for what I specifically replace.
Is this a bug? Is this intended behavior? Is there anything I can do
about this?
Advice appreciated.
Jonathan
---------------------------------------------------------------------
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