Add querystring constant by requested host

Topics: Developer Forum
Oct 12, 2009 at 9:44 AM

Hi...

...I can't match the exact rule to do this: I have some domains (a.com, b.com, c.com) that point to the same website root.

If I call a.com (or www.a.com) I need iirf to rewrite the request always adding a querystring constant like id=a.

The same with the other domains:
b.com   ->  ?id=b + other querystring
c.com   ->  ?id=c + other querystring

thanks

Coordinator
Oct 12, 2009 at 9:32 PM

and what have you tried so far?

    rewritecond  %{HOST}          ^(?!www)(.+)\.com$   [I]
    rewriterule  ^/([^\?]*)       $1?id=%1             [L,QSA]  
    rewritecond  %{HOST}          ^www\.(.+)\.com$     [I]
    rewriterule  ^/([^\?]*)       $1?id=%1             [L,QSA]