ERLomboy_27803
Jul 11, 2014Nimbostratus
Help reviewing an iRule
Hi,
Can someone help me out customize an existing iRule?
when HTTP_REQUEST {
if { [string tolower [HTTP::uri]] ne "/superbook" } {
switch -exact -- [string tolower [HTTP::host]] {
"www.discoverypage.com" {
if {[TCP::local_port] == 80} {
HTTP::respond 301 Location "https://[HTTP::host][HTTP::uri]"
}
elseif { [string tolower [HTTP::uri]] starts_with "/gospels/" } {
if { [string tolower [HTTP::host]] ne "gospels.discoverypage.com" } {
HTTP::respond 301 Location "https://gospels.discoverypage.com[HTTP::uri]"
}
}
}
"discoverypage.com" {
if { [matchclass $::wwwredirects equals [string tolower [HTTP::path]]] } {
HTTP::respond 301 Location "https://www.discoverypage.com[HTTP::uri]"
} elseif { [TCP::local_port] == 80 } {
HTTP::respond 301 Location "https://[HTTP::host][HTTP::uri]"
} elseif { [string tolower [HTTP::uri]] starts_with "/dotnet/excel/114/" || [string tolower [HTTP::uri]] starts_with "/dotnet/excel/102/" } {
HTTP::respond 301 Location "https://www.discoverypage.com[HTTP::uri]"
}
elseif { [string tolower [HTTP::uri]] starts_with "/forumsdotnet/" } {
if { [string tolower [HTTP::host]] ne "forums.discoverypage.com" } {
HTTP::respond 301 Location "https://forums.discoverypage.com[HTTP::uri]"
}
}
}
default {
if { [TCP::local_port] == 80 } {
HTTP::respond 301 Location "https://[HTTP::host][HTTP::uri]"
}
}
}
} else {
HTTP::redirect http://superbook.discoverypage.com
}
}
We have a site (superbook.discoverypage.com) that will be shutdown but the market team wants the site still get redirected to our main site (www.discoverypage.com). When I type the cname to a browser, it adds its name as a prefix to the main site.
Please help modify the iRule above so when users try to hit superbook.discoverypage.com, it will get redirected to www.discoverpage.com.
I'm not sure what to do as well with the else statement since the site superbook.discoverypage.com will eventually get shut down. Please advise on this as well.
PS: I replaced the sites with dummy ones. 🙂
Thanks!!!