Forum Discussion

Jason_40769's avatar
Jason_40769
Icon for Nimbostratus rankNimbostratus
Apr 18, 2011

Subdomain Redirect

I am trying to redirect subdomain and a domain name to have www but the F5 doesn't recognize the subdomain redirect. What I have:

 

 

when HTTP_REQUEST {

 

 

 

if { [HTTP::host] == "domain.com/member" } {

 

HTTP::redirect "www.domain.com/member"

 

}

 

 

if { [HTTP::host] == "domain.com" } {

 

HTTP::redirect "www.domain.com"

 

}

 

}

 

 

  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    I think what you're looking for is:

    
    when HTTP_REQUEST {
      if {[HTTP::host] eq "domain.com" } {
        if {[HTTP::uri] eq "/member"} {
          HTTP::redirect "http://www.domain.com/member"
        } else {
          HTTP::redirect "http://www.domain.com"
        }
      }
    }
    

    Colin
  • Actually this is working Great!! Thanks a lot! I thought i tried something similar to your rule but i was slightly off in the wording. Sad Face =(