Forum Discussion
hooleylist
Aug 04, 2010Cirrostratus
Hi Joe,
You can nest switch cases as shown below. I've split out the host and URI check you were trying to do together into separate switch cases. Also, you don't need an explicit return statement in each switch case. Once a switch case matches, no other switch cases in the same statement will be evaluated.
when HTTP_REQUEST {
Check the Host header value, set to lowercase
switch -glob [string tolower [HTTP::host]] {
"events.oursite.com" {
Check the URI, set to lowercase
switch [string tolower [HTTP::uri]] {
"/event.aspx?event=someevent2010" {
HTTP::redirect "https://sub.domain.com/events/some-url-2010/home.aspx"
}
}
}
"*somedomain1.*" {
HTTP::redirect "https://somesite.com/EventOverview.aspx?Event=someevent1"
}
"*somedomain2.*" {
HTTP::redirect "https://anothersite.com/EventOverview.aspx?Event=someevent2"
}
"*somedomain3.*" {
HTTP::redirect "https://oursite.com"
}
}
}
Aaron