Forum Discussion

Amit585731's avatar
Amit585731
Icon for Nimbostratus rankNimbostratus
Mar 17, 2015

URL redirection

Hi All,

 

Is it possible to redirect traffic based on url. Currently we have setup LTM in such a way that traffic hitting 'abc.com' is routed to 'xyz.com'. But due to certain issue we now need to configure LTM in such a way that traffic hitting 'abc.com' should be redirected to 'xyz.com' except for url 'abc.com/def'. When user hitting url 'abc.com/def' they shouldn't be redirected to xyz.com, instead they should be on url 'abc.com/def'.

 

Thanks

 

1 Reply

  • You can do this simply with an iRule like this:

    when HTTP_REQUEST {
        switch [string tolower [HTTP::host]] {
            "abc.com" -
            "www.abc.com" {
                 You could use "starts_with" instead if you wanted.
                if {!([string tolower [HTTP::uri]] equals "/def")} {
                     This will use the same protocol that is currently being used on the request
                    HTTP::redirect "//xyz.com[HTTP::uri]"
                    return
                }
            }
        }
    }