httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sven Köhler <skoeh...@upb.de>
Subject [users@httpd] How to properly build querystring in RewriteRule
Date Sat, 28 Jun 2008 19:42:28 GMT
Hi,

so i'd like to do the following:

If a Browser sends a request to "http://anyname.myserver.de" then i'd 
like to redirect the browser to
   http://www.myserver.de/domain=name=anyname.myserver.de

If course, if anyname is substituted by ??? or &&& or ===, i still want 
things to work properly - that is:
   chars like ?&= must be replaced by  % following two hex digits.

Here's what i've tried so far:


RewriteEngine On
RewriteMap mymap int:escape

1) RewriteRule ^/test
   http://www.myserver.de/domain?name=%{HTTP_HOST} [L,R=301]

2) RewriteRule ^/test
   http://www.myserver.de/domain?name=${mymap:%{HTTP_HOST}} [L,R=301]


So the escape-map used in 2) sucks. It doesn't escape & or = or ?
The rule 1) simply redirects to URLs such as
   http://www.myserver.de/domain?name=&&&
   http://www.myserver.de/domain?name=???
   http://www.myserver.de/domain?name====

URLs which i simply consider very harmful.


What's the apache-way of properly doing this?
I don't want to have an external program for doing the mapping. This is 
such a standard-task (building a properly escaped querystring) - there 
must be way.


I'm using apache 2.2.9 on Linux.


Regards,
   Sven


Mime
View raw message