Forum Discussion

Yugandhar's avatar
Icon for Nimbostratus rankNimbostratus
Jun 09, 2018

Reg URL Redirection using IRule



Is it possible to redirect a particular HTTP request to a particular URL based on the hostname and all other HTTP requests for that VIP to another URL using the following iRule.


when HTTP_REQUEST { if { [string tolower [HTTP::host]] equals "" } { HTTP::redirect ""; } else {HTTP::redirect "";}




Is it mandatory to use [string tolower ] when we are matching a [HTTP::host] Or can the iRule be written as


when HTTP_REQUEST { if { [HTTP::host] equals "" } { HTTP::redirect ""; } else {HTTP::redirect "";}








1 Reply

  • Yes, this is possible. The

    string tolower
    function isn't mandatory, but it's probably better to use it so you will catch all upper- and lowercase variations of the hostname.

    I see you use semicolons in your iRule. You don't need these.