Multiple domain redirects to subdomain

I have multiple domains on a single VIP using host headers. I would like an irule to redirect sitea.com to , siteb.com to and so on.

I think it can be done in a data group and iRule, but when I tested the following it didn’t work.

Data Group List MULTI-SITE-IRULE sitea.com:= siteb.com:= sitec.com:= sited.com:= sitee.com:=

irule when HTTP_REQUEST { if {[set redir_host [class match -value -- [string tolower [HTTP::host]] equals MULTI-SITE-IRULE]] ne “” }{ HTTP::redirect $redir_host }

What am I doing wrong?

Have you tried to tie all that together with a Virtual Server? Seems to me that there’s a solution on Ron Williams’ website. And there’s a thread on Stackoverflow https://stackoverflow.com/questions/17365397/redirect-multiple-domains-to-one-domain-with-or-without-www-before do my homework. You can use

RewriteCond %{HTTP_HOST} ^/?(?:www\.)?domain1.com

for the domain with leading www.

Hi rwagner1, You can use the below iRule.

when HTTP_REQUEST { 
if { !([HTTP::host] starts_with "www") }  { 
HTTP::redirect "https://www.[HTTP::host]"
}
}