Joe_Pipitone
May 12, 2010Nimbostratus
More conflicts with redirect iRule
I am getting the following error with the iRule below. Something about no such variable when executing. Perhaps this is because there is no URI sometimes if the user requests the homepage? Can anyone help with this one too?
TCL error: more_redirects HTTP_REQUEST -
cant read my_uri: no such variable while executing
HTTP::redirect http://legacy.site.com$my_uri
when HTTP_REQUEST {
if { [string tolower [HTTP::uri]] equals "/url1" or [string tolower [HTTP::uri]] equals "/url1/" } {
HTTP::redirect "http://somesite.com/url2/"
}
set my_uri [string tolower [HTTP::uri]]
if { $my_uri starts_with "/images" } {
redirect to legacy.somesite.com/images on matching URI
HTTP::redirect http://legacy.somesite.com$my_uri
}
if { ([HTTP::host] eq "www.somesite.com") } {
switch -glob [HTTP::uri] {
"/" { HTTP::redirect "http://somesite.com" }
default { HTTP::redirect "http://somesite.com[HTTP::uri]" }
}
}
}