Forum Discussion

jrosales2000_10's avatar
jrosales2000_10
Icon for Nimbostratus rankNimbostratus
Apr 29, 2011

What did i do wrong with this irule for redirection based on url

Hi, i am trying to accomplish the following (we are running LTM 1600's version 9.4.6):

 

 

If a user enters url: oem1.website.com they are routed to oem1.website.com/oem1/vin.aspx

 

 

If a user enters url: oem2.website.com they are routed to oem2.website.com/oem2/vin.aspx

 

 

There is one Virtual Server (and one website in IIS) that serves the content for both of these oem's, however, based on the url entered, i want them each to go to their correct subfolder that contains pages that are skinned for their particular oem.

 

 

I have tried using the following irule:

 

 

when HTTP_REQUEST {

 

if {[string tolower [HTTP::host]] eq "oem1.website.com" } {

 

HTTP::uri "/oem1/vin.aspx"

 

}

 

if {[string tolower [HTTP::host]] eq "oem2.website.com" } {

 

HTTP::uri "/oem2/vin.aspx"

 

}

 

}

 

 

The problem i am having is that no matter what the user enters for a complete url (ie - oem1.website.com/oem1/images/image.jpg) it is routing the user back to that /oem1/vin.aspx.

 

 

On my initial shot at the irule, i wanted to have the irule work for all environments, (dev.oem1.website.com, qatest.oem1.website.com, etc), so in place of the EQUALS above, i used CONTAINS. I figured this is what was causing all traffic containing the url to be routed to the vin.aspx page. I thought maybe changing it to EQUALS would allow the rest of the traffic to flow appropriately, but it isn't working, so i didn't do something correctly.

 

 

I don't use irules too much, (i gleaned what i do know from these forums) :), any help would be appreciated! If i am off base on my approach, and you think another method would work better, i am open to suggestions!

 

 

Thanks!

 

Jodie

 

 

Edited to change equals to eq and to note that it is just one virtual server.

13 Replies