Hi Khoa,
I'd replace the if statements with a switch statement. This will save you from setting the host to lower case multiple times and lower the number of checks performed if a match is found:
when HTTP_REQUEST {
if {[HTTP::path] eq "/"}{
switch [string tolower [HTTP::host]] {
"www.xyzabc.com" -
"xyzabc.com" {
HTTP::redirect "https://www.xyzabc.com/xyz/web_portal/web/home/"
}
"www.hd.xyzabc.com" -
"hd.xyzabc.com" {
HTTP::redirect "https://www.xyzabc.com/xyz/web_portal/web/thuchanh_xyz/"
}
"www.kyso.xyzabc.com" -
"kyso.xyzabc.com" {
HTTP::redirect "https://kyso.xyzabc.com/digitalsign/web/"
}
"www.kyso.xyzabc.com" -
"kyso.xyzabc.com" {
HTTP::redirect "https://kyso.xyzabc.com/digitalsign/web/"
}
default {
Take some default action of the HTTP path is / and there isn't a match on the host?
}
}
}
}
Note that I left out the switch condition for this block of code as the host is already listed above:
if { [string tolower [HTTP::host]] eq "
www.hd.xyzabc.com"} {
if { [string tolower [HTTP::uri]] eq "/" } {
HTTP::redirect "
https://kyso.xyzabc.com/digitalsign/web/"
}
}
Aaron