Forum Discussion
dsirrine_24840
Altostratus
Aug 18, 2009subdomain 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.
- dennypayne
Employee
Hi,when HTTP_REQUEST { if {[HTTP::host] eq "users.foo.com"} { log local0. "Found users in [HTTP::host]" HTTP::respond 301 Location "http://sub.bar.com/account/login/" } elseif {[HTTP::host] contains "foo.com"} { log local0. "Did not find users in [HTTP::host]" HTTP::respond 301 Location "http://www.bar.com/foo" }
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects