Forum Discussion
shaggy
Nimbostratus
if it's a list of hostnames that isn't too large and won't be changing too often, i would just use some or's:
when HTTP_REQUEST {
if {([string tolower [HTTP::host]] equals "www.example.com") or ([string tolower [HTTP::host]] equals "abccorp.com" or [string tolower [HTTP::host]] equals "xyzmedia.ca")} {
HTTP::redirect "https://mywebsite.com"
}
}
if you want the irule to be more flexible and extensible in regards to adding hostnames, you should use a data group. create data-group (reference in irule below as hostname-data-group) with a list of the hostnames you want redirected, and use an irule similar to:
when HTTP_REQUEST {
if { class match [string tolower [HTTP::host]] equals hostname-data-group } {
HTTP::redirect "https://mywebsite.com"
}
}
sandy16
Dec 04, 2014Altostratus
Thanks Shaggy.