Forum Discussion
Joe_Pipitone
Oct 06, 2015Nimbostratus
Why can't we do this with a switch statement? I've tried this code, however I get a redirect loop as well.
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::uri]] {
"/articles/2015/09/09/something.aspx" {
HTTP::redirect http://[getfield [HTTP::host] ":" 1][HTTP::uri]
return
}
default {
if {([string tolower [HTTP::host]] starts_with "www.")} {
HTTP::redirect "https://[string range [HTTP::host] 4 end][HTTP::uri]"
return
} elseif { [TCP::local_port clientside] == 80 } {
HTTP::redirect https://[HTTP::host][HTTP::uri]
return
}
}
}
}