Forum Discussion

dacrud_18985's avatar
dacrud_18985
Icon for Nimbostratus rankNimbostratus
May 16, 2008

subdomain irule redirect

Hi all,

 

 

I'm trying to get an iRule to do this:

 

 

http://*anything*.domain.com/blah/blah redirect to http://www.domain.com/blah/blah

 

 

Any help would be much appreciated.

2 Replies

  • Use getfield:

     
     when HTTP_REQUEST { 
       if { [HTTP::host] contains "domain.com"} { 
         HTTP::redirect http://www[getfield [HTTP::host] ".domain.com" 2][HTTP::uri] 
       } 
     } 
     

    Click here for the wiki page for getfield.