How to properly build querystring in RewriteRule

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux