Forum Discussion

Saidur900's avatar
Icon for Nimbostratus rankNimbostratus
Jan 10, 2022

iRule for redirection

Dear All


Can anyone suggest me the irule for an url redirection? I want to redirect from to

Please suggest me if the LTM policy also solve the purpose.


Thanks in Advance

3 Replies

  • Hello  

    Below iRule should fulfil your requirement.

    when HTTP_REQUEST {
    if { [HTTP::host] eq "" }

    Yes LTM policy will also solve your requirement. Attached snap shows the sample policy.

    Hope it helps!

    • Saidur900's avatar
      Icon for Nimbostratus rankNimbostratus

      Hi Mayur

      I already tried with the Ltm policy, but site ( not coming with the policy, but redirection is happening there. and without policy if I browse directly its coming.

      I will check the irule, and let you know.


      Many thanks for your valuable suggestion.

      • CA_Valli's avatar
        Icon for MVP rankMVP

        Be careful with this code since any HTTP path would be redirected to /xyz/ , also the opening " { " bracket at line 3 needs to be moved in line 2 for proper syntax.


        If you need to match only "/" path use the following code instead.

        This will append /xyz/ without issuing a redirect -- based on your previous comment, I'm assuming the /xyz/ path is hosted within the same pool you use for load balancing ; a redirect will be required if this is not the case

        when HTTP_REQUEST {
           if {[HTTP::host] eq "" && [HTTP::path] eq "/"}{ HTTP::uri "/xyz/" }