Forum Discussion

Greg_Bishop_104's avatar
Greg_Bishop_104
Icon for Nimbostratus rankNimbostratus
Mar 15, 2009

Redirect based on lists

Hi there, I think what I am aiming for is redirection based on two lists. So I'm thinking something like:

 

 

set uri [string tolower [HTTP::uri]]

 

set originallist [list "john" "sue" "nancy"]

 

set newlist [list "john2" "sue4" "nancy7"]

 

 

if { $uri ... in originallist }

 

HTTP::redirect http://www.domain.com/sites/...matching value from newlist

 

 

e.g. john goes to john2, sue goes to sue4, etc.

 

 

I would rather figure out how to do this than:

 

 

if { $uri equals "john" } { HTTP::redirect http://www.domain.com/sites/john2 }

 

elseif { $uri equals "sue" } { HTTP::redirect http://www.domain.com/sites/sue4 }

 

 

because these lists are going to be several hundred values long.

 

 

I apologize, I'm no programmer and I know zilch about matching, switching, arrays, lists, etc. Any help would be greatly appreciated!

 

 

Thanks,

 

 

Greg
  • Patrick_Chang_7's avatar
    Patrick_Chang_7
    Historic F5 Account
    Proxypass iRule is your friend. http://devcentral.f5.com/wiki/default.aspx/iRules/ProxyPass.html