Forum Discussion
Joe_Pipitone
Nimbostratus
May 27, 2014My other iRule that uses if statements - it is only working with uppercase.
I was able to get everything to work by removing the string tolower, and adding in an additional switch statement for both uppercase and lowercase. I can't explain why this works, but string tolower is not working. Here is the complete code that works now:
Check the Host header value, set to lowercase
switch -glob [string tolower [HTTP::host]] {
"oldforum.olddomain.com" {
switch -glob [HTTP::query] {
"TID=*" {
log local0. "Query string of URI [HTTP::uri] is [URI::query [HTTP::uri]]"
HTTP::redirect "http://newforum.newdomain.com/default.aspx?g=posts&t=[URI::query [HTTP::uri] TID]"
return
}
"tid=*" {
log local0. "Query string of URI [HTTP::uri] is [URI::query [HTTP::uri]]"
HTTP::redirect "http://newforum.newdomain.com/default.aspx?g=posts&t=[URI::query [HTTP::uri] tid]"
return
}
"FID=*" {
log local0. "Query string of URI [HTTP::uri] is [URI::query [HTTP::uri]]"
HTTP::redirect "http://newforum.newdomain.com/default.aspx?g=topics&f=[URI::query [HTTP::uri] FID]"
return
}
"fid=*" {
log local0. "Query string of URI [HTTP::uri] is [URI::query [HTTP::uri]]"
HTTP::redirect "http://newforum.newdomain.com/default.aspx?g=topics&f=[URI::query [HTTP::uri] fid]"
return
}
"C=*" {
log local0. "Query string of URI [HTTP::uri] is [URI::query [HTTP::uri]]"
HTTP::redirect "http://newforum.newdomain.com/default.aspx?g=forum&c=[URI::query [HTTP::uri] C]"
return
}
"c=*" {
log local0. "Query string of URI [HTTP::uri] is [URI::query [HTTP::uri]]"
HTTP::redirect "http://newforum.newdomain.com/default.aspx?g=forum&c=[URI::query [HTTP::uri] c]"
return
}
}
}