raytoles_75680
Jan 13, 2010Nimbostratus
Several redirects in one iRule
I want to through this out there to see if any of the experts see any problems with this irule. We have some pretty specific redirects I want to place in a single iRule. Below is a sample of where I'm goint. There's about 15 different author names involved (authorx = author's name). The author's location on the oldsite must be redirected to the author's site location on the new site.
when HTTP_REQUEST priority 499 {
if {[string tolower [HTTP::host]] equals "newsite.apa.org" and [string tolower [HTTP::uri]] starts_with "/newbooks/newresources" } {
set redirected 0
switch -glob [HTTP::uri] {
"/books/resources/author1" {
HTTP::redirect "http://oldsite.apa.org/oldbooks/oldsupp/author1"
}
"/books/resources/author2" {
HTTP::redirect "http://oldsite.apa.org/oldbooks/oldsupp/author2"
}
"/books/resources/author3" {
HTTP::redirect "http://oldsite.apa.org/oldbooks/oldsupp/author3"
}
"/books/resources/author4" {
HTTP::redirect "http://oldsite.apa.org/oldbooks/oldsupp/author4"
}
default {
log local0. "Redirect to New site author root"
HTTP::redirect "http://newsite.apa.org/newpubs/newbooks"
}
}
}
}