Forum Discussion

f5now_28704's avatar
f5now_28704
Icon for Nimbostratus rankNimbostratus
Apr 27, 2009

HTTP::uri slim down the irule

hey guys, currently I have an irule with redirects for some states/cites...long...is there a way of making it smaller...some sort of find and replace.

 

 

when HTTP_REQUEST {

 

if { [string tolower [HTTP::uri]] eq "/oregon-auto-equity-loans.aspx" } {

 

HTTP::redirect "/phoenix-auto-equity-loans.aspx"

 

}

 

if { [string tolower [HTTP::uri]] eq "/oregon-auto-title-loans.aspx" } {

 

HTTP::redirect "/phoenix-auto-title-loans.aspx"

 

}

 

if { [string tolower [HTTP::uri]] eq "/oregon-car-title-loans.aspx" } {

 

HTTP::redirect "/phoenix-car-title-loans.aspx "

 

}

 

if { [string tolower [HTTP::uri]] eq "/illinois-cash-car-title-loans.aspx" } {

 

HTTP::redirect "/los-angeles-cash-car-title-loans.aspx"

 

}

 

 

something to find anything "oregon" and swapit with "phoenix" also "illinois" to "los-angeles"
  • Maybe something like this?

     
     when HTTP_REQUEST { 
      
         Check if request contains either "find" string 
        switch [string tolower [HTTP::path]]}{ 
      
           "oregon" - 
           "illinois" { 
              HTTP::redirect "http://[HTTP::host][string map {oregon phoenix illinois los-angeles} [HTTP::uri]]" 
           } 
        } 
     } 
     

    Aaron