Various rewrites/redirects on one VIP
I am currently burning up 3 VIPs to get all these redirects and rewrites working, however I'd like to efficiently combine the iRule, and point all 3 domains to the same VIP and accomplish the same thing. Having some issues and there are redirect loops occurring.
I have 2 domains, and 2 subdomains, which I've masked as:
olddomain.com
newdomain.com newforum.newdomain.com oldforum.olddomain.comI need to allow all traffic to newdomain.com, and newforum.newdomain.com. This iRule needs to catch all traffic going to olddomain.com, append the URI, and rewrite to newdomain.com. I also have to catch all forum requests, and rewrite the domain and path. This is already working on a separate VIP. I tried catching both www.olddomain.com and olddomain.com with an asterisk, but it doesn't seem to work. If anyone has any ideas on what I may be missing, please let me know. Thank you!
Rewrites for 3 separate domains on one VIP. Also rewrites forum requests from old forum to new forum
when HTTP_REQUEST {
This needs to catch oldforum.olddomain.com and rewrite to newforum.newdomain.com
if { [HTTP::query] contains "TID=" } {
HTTP::redirect "http://newforum.newdomain.com/default.aspx?g=posts&t=[URI::query [HTTP::uri] TID]"
return
}
if { [HTTP::query] contains "FID=" } {
HTTP::redirect "http://newforum.newdomain.com/default.aspx?g=topics&f=[URI::query [HTTP::uri] FID]"
return
}
if { [HTTP::query] contains "C=" } {
HTTP::redirect "http://newforum.newdomain.com/default.aspx?g=forum&c=[URI::query [HTTP::uri] C]"
return
}
This needs to catch newdomain.com and analyze URI
if { [string tolower [HTTP::uri]] contains "somestring" } {
HTTP::redirect "http://newdomain.com/some/path/somepage.aspx?eofseckey=233729AF8"
return
}
This needs to catch newforum.newdomain.com on port 80, append URI, and redirect to port 443
if { ([HTTP::host] eq "oldforum.olddomain.com") } {
switch -glob [HTTP::host] {
"/" { HTTP::redirect "https://newforum.newdomain.com" }
default { HTTP::redirect "https://newforum.newdomain.com[HTTP::uri]" }
}
}
This needs to catch various requests to olddomain.com and rewrite to newdomain.com
if { ([HTTP::host] contains "olddomain.com") } {
switch -glob [HTTP::host] {
"/" { HTTP::redirect "http://newdomain.com" }
default { HTTP::redirect "http://newdomain.com[HTTP::uri]" }
"/oldpath/path/oldpage-2013.aspx" {
HTTP::redirect "http://newdomain.com/new-path/newpage.aspx"
return
}
"/faq*" {
HTTP::redirect "http://another.domain.com/some/path/FAQ.pdf"
return
}
}
}
}