Tom_Brandl_9318
Aug 17, 2006Nimbostratus
HTTP_REQUEST & if, elseif, else statements
Hello,
I am trying to consolidate multiple redirection rules with if, elseif, else statements. I've researched various posts in the forum and still can't seem to get the syntax correct. Any assistance would be greatly appreciated. Here's my script:
when HTTP_REQUEST {
set host [string tolower [HTTP::host]]
if {$host contains "2006wec"} {
HTTP::redirect "http://[HTTP::host]/cms/mpiweb/wec2006/wechomepage.aspx?id=4829"
} elseif {$host contains "institutes"} {
HTTP::redirect "http://[HTTP::host]/cms/mpiweb/Inst2006/inst06_template.aspx?id=5935"
} elseif {$host contains "cmm"} {
HTTP::redirect "http://[HTTP::host]/cms/mpiweb/cmm2006/cmm06_template.aspx?id=5794"
} else {$host contains "wli"} {
HTTP::redirect "http://[HTTP::host]/cms/mpiweb/mpicontent.aspx?id=1210"
}
}
This is the error condition that I receive:
01070151:3: Rule [redirect_subdomain_rule] error:
line 7: [deprecated usage, use else or elseif] [ ]
line 3: [undefined procedure:
HTTP::redirect "http://[HTTP::host]/cms/mpiweb/cmm2006/cmm06_template.aspx?id=5794"
] [if {$host contains "2006wec"} {
HTTP::redirect "http://[HTTP::host]/cms/mpiweb/wec2006/wechomepage.aspx?id=4829"
} elseif {$host contains "institutes"} {
HTTP::redirect "http://[HTTP::host]/cms/mpiweb/Inst2006/inst06_template.aspx?id=5935"
} else {$host contains "cmm"} {
HTTP::redirect "http://[HTTP::host]/cms/mpiweb/cmm2006/cmm06_template.aspx?id=5794"
}]