Forum Discussion
Daniel_Ma_23954
Nimbostratus
Feb 09, 2016Redirect both host and path via iRules
I"m fairly new to using iRules and writing redirects, but currently I have a redirect in place that does http to https redirect via the switch parameter for different host names, see below.
when H...
Kevin_Stewart
Employee
Feb 09, 2016If it's just a few conditions you could reasonably nest switch statements:
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::host]] {
"abc.com" -
"www.abc.com" {
HTTP::redirect http://abc.123.com
}
"def.com" -
"www.def.com" {
switch -glob [string tolower [HTTP::uri]] {
"/example*" {
HTTP::redirect "https://www.def.com/site1/example"
}
default {
HTTP::redirect https://www.def.com[HTTP::uri]
}
}
}
default {
reject
}
}
}
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
