Forum Discussion
Darren_Person_2
Nimbostratus
Nov 03, 2006iRule URL Rewrite for Multiple domains
Can someone explain how to approach this problem?
I have multiple domains that each need to 302 redirect back to their primary's:
For example,
i have:
www.test.com ...
John_Pope_42012
Nimbostratus
May 28, 2007when HTTP_REQUEST {
if { [HTTP::uri] contains "select" } {
use pool web_pool_web02
} elseif { [HTTP::uri] contains "survey" } {
use pool web_pool_web02
} elseif { [HTTP::uri] contains "bcaonline" } {
use pool web_pool_web01
} elseif { [HTTP::uri] contains "onlinene" } {
use pool web_pool_web02
} elseif { [HTTP::uri] contains "onlinesubscadmin" } {
use pool web_pool_web02
} elseif { [HTTP::uri] contains "MAILFORM" } {
use pool cms_saiglobal
} elseif { [HTTP::host] contains "saiglobal.com.au" } {
HTTP::redirect "http://www.saiglobal.com/[HTTP::uri]"
} elseif { ([HTTP::host] contains "sai-global.com.au") and ([HTTP::uri] contains "shop") } {
HTTP::redirect "http://www.saiglobal.com/[HTTP::uri]"
} elseif { [HTTP::host] contains "saiglobalinc.com" } {
[HTTP::redirect "http://www.saiglobal.com/[HTTP::uri]"
} elseif { [HTTP::host] contains "qas.com.au" } {
HTTP::redirect "http://www.saiglobal.com/[HTTP::uri]"
} elseif { ([HTTP::host] contains "www.standards.com.au") and ([HTTP::uri] contains "catalogue") } {
HTTP::redirect "http://www.saiglobal.com/[HTTP::uri]"
} elseif { ([HTTP::host] contains "cqc-sai.com") and ([HTTP::uri] contains "shop") } {
HTTP::redirect "http://www.saiglobal.com/[HTTP::uri]"
} elseif { ([HTTP::host] contains "sai-global.com") and ([HTTP::uri] contains "shop") } {
HTTP::redirect "http://www.saiglobal.com/[HTTP::uri]"
} else {
use pool web_pool_shop
}
}
The first few lines at the top do some load balancing to different pools.
I then have some detections which descriminates redirects if the traffic is on specific uri eg. if the directory path is /shop and the domain name is bla bla then redirect. This has been necessary as we have a cms that handles a lot of virtual sites /directories within IIS. however, if I simply do a find and replace (something the irule editor doesn't have)
find
replace
the irule says that the rule is valid, but my sites start failing.
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