gdoyle
Oct 03, 2018Cirrostratus
Multiple URL's redirecting the URI's.
I have a customer that is based out of multiple states, each states website is "mywebsiteXX.com" where XX is the state code (e.g. NY for New York, FL for Florida).
All of these come in to the same VIP (VIP is called mywebsitexx.com), but are then pointed to the their states website. If they have the URI "getstarted" or "feedback" the customer wants them redirected to "/web/xx/getstarted" or "web/xx/feedback" where xx is the state code.
Would something like this work in the irule or is this not going to detect the URL properly?
switch -glob [string tolower [HTTP::uri]] {
"/getstarted*" {
switch -glob [string tolower [HTTP::host]] {
"*mywebsiteaz*" { HTTP::respond 301 "Location" "https://mywebsiteaz.com/web/xx/getstarted" }
"*mywebsitefl*" { HTTP::respond 301 "Location" "https://mywebsitefl.com/web/xx/getstarted" }
"*mywebsiteny*" { HTTP::respond 301 "Location" "https://mywebsiteny.com/web/xx/getstarted" }
default { discard }
}
}
"/feedback*" {
switch -glob [string tolower [HTTP::host]] {
"*mywebsiteaz*" { HTTP::respond 301 "Location" "https://mywebsiteaz.com/web/xx/feedback" }
"*mywebsitefl*" { HTTP::respond 301 "Location" "https://mywebsitefl.com/web/xx/feedback" }
"*mywebsiteny*" { HTTP::respond 301 "Location" "https://mywebsiteny.com/web/xx/feedback" }
default { discard }
}
}
}