rwagner1
Mar 01, 2021Nimbostratus
iRule Multiple site redirect
How do I write an iRule that redirects multiple sites.
Site 1) aaa.com redirects to www.bbb.com/ccc/ddd
Site 2) eee.com redirects to www.bbb.com/fff
Site 3) ggg.com redirects to www.bbb.com/hhh
I thought it should look like this but it's not right.
when HTTP_REQUEST {
if { [string tolower [HTTP::host]] contains "aaa.com" } {
HTTP::header replace "Host" "www.bbb.com"
HTTP::uri "/ccc/ddd[HTTP::uri]"
} {
if { [string tolower [HTTP::host]] contains "eee.com" } {
HTTP::header replace "Host" "www.bbb.com"
HTTP::uri "/fff[HTTP::uri]"
} {
if { [string tolower [HTTP::host]] contains "ggg.com" } {
HTTP::header replace "Host" "www.bbb.com"
HTTP::uri "/hhh[HTTP::uri]"
}