Forum Discussion
giltjr
Apr 24, 2014Nimbostratus
Try the following. I think you had some { } out of order and you had a "else {if" when a elseif was better.
domain1, domain2, and forum rewrites
when HTTP_REQUEST {
if {[HTTP::host] == "oldforum.olddomain.com"} {
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
}
} elseif { ([HTTP::host] ends_with "newdomain.com") or ([HTTP::host] ends_with "olddomain.com") } {
This needs to catch newdomain.com/uri or olddomain.com/uri and redirect
log local0. "Hostname is [HTTP::host]"
if { [string tolower [HTTP::uri]] contains "secure" } {
HTTP::redirect "http://newdomain.com/Issues/2014/04/some-page.aspx"
return
} elseif { [string tolower [HTTP::uri]] contains "secure2" } {
HTTP::redirect "http://newdomain.com/Issues/2014/04/some-other-page.aspx"
return
}
}
}