when HTTP_REQUEST {
Check if host is abc.com
if {[string tolower [HTTP::host]] eq “abc.com”}{
Rewrite the URI to /irj
HTTP::uri “/irj”
}
}
else
{
check if host is xyz.com
if {[string tolower [HTTP::host]] eq "xyz.com}{
rewrite the uri to /irq
HTTP::uri “/irq”
}
}
I have really never used more than one url. I need to append the URI. I want to know if the ‘else’ is correct or is it ‘else if’
nitass
2
can u try this?
when HTTP_REQUEST {
if {[string tolower [HTTP::host]] eq “abc.com”} {
HTTP::uri “/irj”
} elseif {[string tolower [HTTP::host]] eq “xyz.com”} {
HTTP::uri “/irq”
} else {
do something
}
}
or
when HTTP_REQUEST {
switch [string tolower [HTTP::host]] {
“abc.com” {
HTTP::uri “/irj”
}
“xyz.com” {
HTTP::uri “/irq”
}
default {
do something
}
}
}
Keep in mind that your iRule as it’s written will redirect all requests to a single URI. Just making sure that’s what you want. 