Forum Discussion
Joe_Pipitone
Nimbostratus
Jun 05, 2009Redirect - adding elseif
I want to add multiple redirect statements to a single iRule, when a match is found, redirect, else, keep going until i find a match. Can anyone tell me what i am missing here?
when HT...
Joe_Pipitone
Nimbostratus
Jun 05, 2009OK, so I did some further reading and found it was best to use a switch statement.
The problem now is, I would like to listen for www.domain1.com as well as domain1.com, with and without the www. I tried using && and ||, each triggered a syntax error. This is my iRule:
when HTTP_REQUEST {
set h [HTTP::host]
set u [HTTP::uri]
switch -glob $h {
"domain1.com" {
HTTP::redirect "http://domain2.com"
}
"domain3.org" {
HTTP::redirect "http://domain4.org"
}
}
}
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
