Forum Discussion

Ajit's avatar
Ajit
Icon for Altostratus rankAltostratus
Sep 25, 2015

HTTP redirection irule

Hello Team,

 

I have created a VIP with IP address : 172.16.214.231. This is for a new website abc.com. The public to private natting happens on the firewall that sits before the F5. The DNS entry of abc.com is mapped with the public IP address.

 

What i need is when someone enters abc.com he should be directed to abc.com/us/en/product-solutions/transportation/find-a-cellphone-pc.aspx

 

I believe that this is possible with an irule & i am just a beginner in irules. Kindly advise.

 

Thank you in advance.

 

4 Replies

  • just to be clear, you only want to re-direct a request to the root of the site to /us/en/product-solutions/transportation/find-a-cellphone-pc.aspx?

     

    In other words any other URI is fine as is, you just want to re-direct abc.com/ to abc.com/us/en/product-solutions/transportation/find-a-cellphone-pc.aspx

     

  • Ajit's avatar
    Ajit
    Icon for Altostratus rankAltostratus

    Hello Jdam,

     

    That is correct. Can you help me with the irule for the same or is there another way i can do it using HTTP class?

     

    Awaiting your response. Thank you.

     

  • You're iRule might look something like this:

    when HTTP_REQUEST {
        switch [string tolower "[HTTP::host][HTTP::uri]"] {
            "abc.com/" -
            "www.abc.com/" {
                HTTP::redirect "/us/en/product-solutions/transportation/find-a-cellphone-pc.aspx"
                return
            }
        }
    }
    

    The other option (if you're using v11.4 or greater) is Local Traffic Policies. Simple actions (including redirects) can be done there and may be simpler to configure if you're not used to iRules. This question has an example that might guide you in the right direction if you wanted to do it that way.