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”

}]

I think it’s the last test with else. The else should not be conditional, so either use elseif again, or remove the {$host contains “cmm”} part.

Aaron

Hoolio - thanks a million. It was the last conditional statement - replaced with elseif and it works like a champ!