Forum Discussion

Joe_Pipitone's avatar
Joe_Pipitone
Icon for Nimbostratus rankNimbostratus
Nov 16, 2009

HTTP Redirect using switch issue

The following iRule isn't redirecting properly - these are supposed to be going to 4 separate URIs.

I moved over to a switch statement because I was getting a similar behavior - it's as if it is catching the /lv2010/es* first. I have tried removing the asterisks, but that did not work.

Can anyone help?

  
    
  when HTTP_REQUEST {   
     switch -glob [string tolower [HTTP::uri]] {    
      "/lv2010/es/register*" {   
        HTTP::redirect "http://ourdomain.org/registration.aspx"   
      }   
      "/lv2010/es/hotel*" {   
        HTTP::redirect "http://ourdomain.org/hotel-and-travel.aspx"   
      }   
      "/lv2010/es/qualify*" {   
        HTTP::redirect "http://ourdomain.org/qualification.aspx"   
      }   
      "/lv2010/es*" {   
        HTTP::redirect "http://ourdomain.org/home.aspx"   
      }   
      "/lv2010*" {  
       HTTP::redirect "http://ourdomain.org/home.aspx"  
     } 
  

2 Replies

  • It appears as though the problem was the asterisk following /lv2010*. I've taken this out, and the other rules work.

     

     

    This poses the problem - if someone types in http://ourdomain.org/lv2010/ WITH the forward slash, the redirect does not work.

     

     

    Is there any way around this? If I put the asterisk in there, both with and without the slash work, however it breaks the other 4 redirects.

     

     

    Thanks for any help.