Forum Discussion
Glenn_32883
Nimbostratus
Jun 14, 2010Trying if/elseif irule...
Hi all,
Faced with what I think is some interaction between separate irules, I am trying to see if useing if/elseif would help.
I have an old domain that I want to redirect to my n...
Michael_Yates
Nimbostratus
Jun 14, 2010Try this and see if it works out for you:
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::host]] {
"myoriginal.ca" -
"www.myoriginals.ca" {
if { [HTTP::uri] equals "/" } { HTTP::respond 301 Location "https://mystore.net/ca/catalog/index.aspx" }
}
"myoriginals.ca" -
"www.myoriginals.ca" {
if { [HTTP::uri] equals "/" } { HTTP::respond 301 Location "https://mystore.net[HTTP::uri]" }
}
}
}
Made the HTTP::redirect into a HTTP::respond because an HTTP::redirect is a 302 (Temporary). With HTTP::respond you can specify the HTTP::status to a 301 (Permanent)
The "myoriginal.ca" - tells it to follow the same action as the one below it (you can keep on doing this if you have more that you want to follow the same action.
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
