Forum Discussion

T_Rajneesh's avatar
T_Rajneesh
Icon for Nimbostratus rankNimbostratus
May 07, 2019

irule redirect to new website

Hi The below i-rule is working fine for redirection to new website. But when user types, abc.com or abc.com/support it is not redirecting and throwing up error 404. can you please help me make correction to below irule to achieve above said functionality.

Thanking you in advance

when HTTP_REQUEST {

set newHost "www.xyz.com"

if {[string tolower [HTTP::host]] eq "www.abc.com"} {
    switch [string tolower [HTTP::uri]] {
        "/support" {
            HTTP::redirect "http://$newHost/en-us/abc-abc-abc-abc-faqs"
        }
        "/" {
            HTTP::redirect "http://$newHost/en-us/family/abc"
        }
    }
}

}

1 Reply

  • Add one more

    OR
    condition in existing iRule.

         when HTTP_REQUEST {
        set newHost "www.xyz.com"
            if {([string tolower [HTTP::host]] eq "www.abc.com")||([string tolower [HTTP::host]] eq "abc.com") } {
        switch [string tolower [HTTP::uri]] {
        "/support" {
                 HTTP::redirect "http://$newHost/en-us/abc-abc-abc-abc-faqs" }
        "/" {
                HTTP::redirect "http://$newHost/en-us/family/abc" }
            }
        }
    }