Forum Discussion

Sunnypro_250536's avatar
Sunnypro_250536
Icon for Nimbostratus rankNimbostratus
Jun 21, 2018

Redirect iRule for specific URI's for a Single VIP.

Hello,

 

I have a requirement where I need to have some redirects enabled to the VIP, the requirement is a combination, and I want to know whether this can be implemented in a single iRule.If so can someone let me know that. Below is the information.

 

  1. Any URL containing “abc.com/uvw” be automatically redirected to https://www.abc.com/uvw/xyz.html

     

  2. abc.com/def (with or without the .) should automatically redirected to https://www.abc.com/def

     

Is this possible to implement in a single iRule or do we need to tag two seperate iRules . Please let me know.

 

Thanks.

 

1 Reply

  • Anesh's avatar
    Anesh
    Icon for Cirrostratus rankCirrostratus

    try

    when HTTP_REQUEST {
      if { !([HTTP::host] starts_with "www.") && ([HTTP::uri] conatins "def") }{
        HTTP::redirect "https://www.[HTTP::host]/def"
      
       }elseif {[HTTP::uri] conatins "uvw"}{
        HTTP::redirect https://www.[HTTP::host]/uvw/xyz.html
       }
    
    
    }