Forum Discussion
gbunting
Nimbostratus
Mar 19, 2009How to clean up multiple if/else redirects?
I have a current iRule that works. It will redirect from www.domainname.com.au to www.domainname.com/au for multiple international domains. The problem is I currently have 7 if/else statements for 7...
gbunting
Nimbostratus
Mar 19, 2009I have changed the Irule to use the switch statement as changed the redirect to the 301 respond. Is there any other optimizations I should do? The majority of the traffic will be going to the default pool (www.domainname.com) can this be optimized by adding that to the beginning of the switch statement or is that not necessary?
when HTTP_REQUEST {
log local0. "in HTTP_REQUEST"
switch [HTTP::host] {
www.domainname.com.br {HTTP::respond 301 Location "http://www.domainname.com/Brazil" }
www.domainname.com.au {HTTP::respond 301 Location "http://www.domainname.com/Australia" }
www.domainname.com.mx {HTTP::respond 301 Location "http://www.domainname.com/Mexico" }
www.domainname.com.ca {HTTP::respond 301 Location "http://www.domainname.com/Canada" }
www.domainname.cz {HTTP::respond 301 Location "http://www.domainname.com/Chech" }
www.domainname.co.jp {HTTP::respond 301 Location "http://www.domainname.com/Japan" }
www.domainname.jp {HTTP::respond 301 Location "http://www.domainname.com/Japan" }
default { pool www.domainname.com }
}
}
Thanks,
Glen
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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