Looks like the variable can't be used in another part of the irule.
have you tried the following
when HTTP_REQUEST {
set ::host [HTTP::host]
set ::url [HTTP::uri]
}
when HTTP_RESPONSE {
if { [HTTP::status] == 404 } {
if { $::host contains "abcd" } {
HTTP::redirect "http://abcd.otherdomain.com/$::url"
} elseif { $::host contains "efg" } {
HTTP::redirect "http://efg.otherdomain.com/$::url"
} else {
HTTP::redirect "http://anotherone.com/xyz.html"
}
}
}
If you noticed I am changing your variable from local to global. I have not tested this, but give that a shot.
CB