For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

birchy's avatar
birchy
Icon for Nimbostratus rankNimbostratus
Feb 19, 2020
Solved

Redirect a subdomain to a sub directory of the root domain

Hey all,

 

i have been asked to redirect a sub domain to a sub directory of the root domain - any pointers on what type of IRule to use?

 

for instance we want to redirect xxxx.aaaa.com to aaaa.com/zzzzz

 

Thanks!

 

  • Following should do what you are asking for::

    when HTTP_REQUEST {
      if { [HTTP::host] contains "xxxx.aaaa.com"} {
        HTTP::redirect "http://aaaa.com/zzzzz"
      }
    }

5 Replies

  • try this. Hope it will work for you.

    when HTTP_REQUEST {
      if { [HTTP::host] eq "xxxx.aaaa.com"} {
        HTTP::redirect "http://aaaa.com/zzzzz"
      }
    }
      
  • NAG's avatar
    NAG
    Icon for Cirrostratus rankCirrostratus

    Following should do what you are asking for::

    when HTTP_REQUEST {
      if { [HTTP::host] contains "xxxx.aaaa.com"} {
        HTTP::redirect "http://aaaa.com/zzzzz"
      }
    }
      • NAG's avatar
        NAG
        Icon for Cirrostratus rankCirrostratus

        Good to know it helped.

        Could you please mark it as answered.​