Forum Discussion
Ankur_5273
Nimbostratus
Jul 27, 2015Redirection multiple URI to different website
Hi Experts,
Kindly let me know how to configure the following redirection in a single irule where the original URL has a different URI according to region.
2 Replies
- Samir_Jha_52506
Noctilucent
Please try this. hope it will work.
when HTTP_REQUEST { set uri [string tolower [HTTP::path]] switch -glob $uri { "/in" { HTTP::redirect "http://New_http_URL_1" } "/us" { HTTP::redirect "http://New_http_URL_2" } "/uk" { HTTP::redirect "http://New_http_URL_3" } "/sg" { HTTP::redirect "http://New_http_URL_4" } } } - Kevin_Stewart
Employee
If I may add.
The -glob option gives you the opportunity to use wildcard matches. So assuming "/in/" is just the start of the URI:
when HTTP_REQUEST { switch -glob [string tolower [HTTP::path]] { "/in/*" { HTTP::redirect "http://New_http_URL_1" } "/us/*" { HTTP::redirect "http://New_http_URL_2" } "/uk/*" { HTTP::redirect "http://New_http_URL_3" } "/sg/*" { HTTP::redirect "http://New_http_URL_4" } } }
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