Forum Discussion

Nilendu_Haldar_'s avatar
Nilendu_Haldar_
Icon for Nimbostratus rankNimbostratus
Jun 18, 2018

Need iRule to redirect URL "'host+uri'/anything" to another "'host'/anything"

Please help. I am urgently looking for an iRule to redirect to .

 

Here "anything" means just anything. Example: Redirect to .....

 

Redirect to

 

1 Reply

  • Hi,

     

    you can use this code :

     

    when HTTP_REQUEST {
        if {[HTTP::host] equals "www.abc.com"} {
            if {[scan [HTTP::uri] {/%[^/]%s} garbage new_uri] == 2} {
                HTTP::redirect ://www.xyz.com${new_uri}
            } else {
                HTTP::redirect ://www.xyz.com/
            }
        }
    }