Forum Discussion

smiley_dba_1116's avatar
smiley_dba_1116
Icon for Nimbostratus rankNimbostratus
Sep 18, 2012

3 websites, 1 VIP, 1 iRule for 1 website

Need help writing an iRule to look at the URL request and to redirect if 1 of the URI's is seen. Example:

 

abc.com

 

def.com

 

ghi.com -> redirect to sorry.ghi.com

 

 

Want to make sure that abc and def.com continue to pass traffic, but only ghi.com gets redirected to sorry.ghi.com. Thoughts. Thanks.

 

 

RGW

 

2 Replies

  • Use an HTTP class, not irules, and simply look for "Host header" equals ghi.com or maybe also www.ghi.com, and select "redirect" in the "action" part.
  • HTTP classes are great, but should you want to use an iRule:

    
    when HTTP_REQUEST {
        if { [string tolower [HTTP::host]] equals "ghi.com" } {
            HTTP::redirect "http://sorry.ghi.com"
        } 
    }