Forum Discussion
ERLomboy_27803
Nimbostratus
Jul 11, 2014Help 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]] {
"...
Arie
Altostratus
Jul 14, 2014This should work if both sites are using the same VIP. If they're not using the same VIP you'll want to move the redirect from superbook.discoverypage.com to www.discoverypage.com to its own iRule and assign that to the VIP for superbook.
when HTTP_REQUEST {
if { [HTTP::host] equals "superbook.discoverypage.com" } {
HTTP::respond 301 Location "http://www.discoverypage.com/"
} else {
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]"
}
}
}
removed redirect to superbook.discoverypage.com
}
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects