Forum Discussion

TT_179079's avatar
TT_179079
Icon for Nimbostratus rankNimbostratus
Sep 27, 2016

irule - host and uri redirect

Hi

 

Looking for assistance to create IRULE to redirect the following urls. Any assistance is appreciated in advance

 

VIP -10.10.10.1 -abcd.com

 

http://abcd.com/ redirected to http://www.xyz.com/providers/systems/electronic/ http://abcd.com/the-advantage/ redirected to http://www.xyz.com/providers/systems/for-you/ http://abcd.com/financial-app redirected to http://www.xyz.com/contact/ http://abcd.com/featured-test-app redirected to http://www.xyz.com/test/

 

3 Replies

  • here is my irule, any comment on modifying the irule

     

    HTTP_REQUEST { if { ([HTTP::host] equals "abcd.com") and ([HTTP::uri] equals "/") } { HTTP::redirect "http://www.xyz.com/providers/systems/electronic/" } if { ([HTTP::host] equals "abcd.com") and ([HTTP::uri] equals "the-advantage/") } { HTTP::redirect "http://www.xyz.com/providers/systems/for-you" } if { ([HTTP::host] equals "abcd.com") and ([HTTP::uri] equals "featured-financial-app") } HTTP::redirect "http://www.xyz.com/contact" } if { ([HTTP::host] equals "abcd.com") and ([HTTP::uri] equals "featured-test-app") } HTTP::redirect "http://www.xyz.com/test" } }

     

  • Here we go:

    when HTTP_REQUEST {
        if {[HTTP::host] equals "abcd.com" } {
            switch -glob [HTTP::uri] {
                "" -
                "/" {
                    HTTP::redirect "http://www.xyz.com/providers/systems/electronic/"
                }
                "/the-advantage*" {
                    HTTP::redirect "http://www.xyz.com/providers/systems/for-you/"
                }
                "/financial-app*" {
                    HTTP::redirect "http://www.xyz.com/contact/"
                }
                "/featured-test-app*" {
                    HTTP::redirect "http://www.xyz.com/test/"
                }
            }
        }
    }
    

    //Jan