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...
Kai_Wilke
MVP
Feb 09, 2016Hi Daniel,
you can add leadings parts whenever you want...
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" {
HTTP::redirect https://www.def.com/site1[HTTP::uri]
}
default {
reject
}
}
}
Note:
[HTTP::uri] always starts with an /, so you don't need to explicitly add a slash.
Cheers, Kai
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
