Forum Discussion
Terry_Pike
Apr 07, 2017Nimbostratus
iRule to redirect with an elseif statement
hi Dev's
Want an iRule to detect the URL – http://xxsupplier.xx.com/supplierguide
and re-direct it to https://xxsupplier.xx.com/supplier_guide.html
But, if the user enters just http://xxsupplier.xx....
Kai_Wilke
Apr 07, 2017MVP
Hi Terry,
you may take a look to the iRule below. The rules uses two nested [if] statements to avoid variable usage.
when HTTP_REQUEST {
if { [string tolower [HTTP::host]] equals "xxsupplier.xx.com" } then {
if { [string tolower [HTTP::uri]] starts_with "/supplierguide" } then {
HTTP::respond 302 Location "https://xxsupplier.xx.com/supplier_guide.html"
} else {
HTTP::respond 302 Location "https://xxsupplier.xx.com[HTTP::uri]"
}
} else {
Request for unknown host name.
}
}
Cheers, Kai
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