Forum Discussion

Carl_Zemke_1882's avatar
Carl_Zemke_1882
Icon for Nimbostratus rankNimbostratus
Jun 06, 2007

UIR rewrite based on Hostname

Sorry for being so ignorant with IRules but for the life of me, I can't seem to get anything working correctly here.

 

 

I need a Rule that will rewrite the URI portion of a HTTP request based on the Hostname.

 

 

If HTTP:host eq Awww.something.com

 

rewrite Awww.something.com/directory1

 

elseif HTTP:host eq Bwww.something.com

 

rewrite Bwww.something.com/directory2

 

else discard

 

 

Thanks in Advance,

 

Carl

1 Reply

  • Try this:

    
    when HTTP_REQUEST {
      if { ([string tolower [HTTP::host]] equals "awww.something.com") } {
        HTTP::uri "/directory1[HTTP::uri]"
      } elseif { ([string tolower [HTTP::host]] equals "bwww.something.com") } {
          HTTP::uri "/directory2[HTTP::uri]"
      } else { discard }
    }