dsirrine_24840
Aug 18, 2009Altostratus
subdomain redirect question
Issue: I have a domain foo.com. foo.com and www.foo.com need to be redirected to www.bar.com/foo. However, users.foo.com needs to be redirected to sub.bar.com/account/login. My irules look as such:
when HTTP_REQUEST {
if {[HTTP::host] eq "users.foo.com"} {
HTTP::respond 301 Location "http://sub.bar.com/account/login/"
}
elseif {[HTTP::host] contains "foo.com"} {
HTTP::respond 301 Location "http://www.bar.com/foo"
}
When I go to foo.com or www.foo.com it will redirect to http://www.bar.com/foo. However, when I go to users.foo.com, it doesn't go to http://sub.bar.com/account/login but rather goes to http://www.bar.com/foo. Is there a special way to do this? Thanks in advance.