Redirection array iRule does not hit
Hi,
Our customer is moving four separate sites to the existing web environment and are in need of redirections of several URL's.
Let's call the sites:
www.alfasite.com www.alfasite.se www.betasite.com www.betasite.se
At every site most of the url's must redirect to the new space on the existing page like this:
www.alfasite.com should redirect to www.existingsite.com/alfa/alfasite/ www.betasite.com should redirect to www.existingsite.com/beta/betasite/
It get's difficult when several of the url's need to be redirected to specific url's on the existing site like this:
www.alfasite.com/contactus should redirect to www.existingsite.com/alfa/alfasite/contact www.alfasite.com/spaa should redirect to www.existingsite.com/alfa/alfasite/bad-rom www.alfasite.com/cykelteori.aspx should redirect to www.existingsite.com/alfa/alfasite/bikes +++ about 200 more of these for both sites, .com and .se.
I've made iRule with a array that usualy handles these kind of redirects in a simple matter, but whith these sites we also need a "catch all" to redirect all url's that are not specified in the array (as most of them should redirect to the main space on the existing site)
I have made 2x iRules, one for each site. Each irule redirects both .com and .se.
I have also made a "catch all" irule that i have placed as lowest priority, that will catch all url's not redirected by the array irules. Notice i have a "event disable" in the redirection arrays to make sure it does not hit the "catch all" irule if the condition is met.
Irules as follows:
2x of this, i will only paste 1. The other one is exactly the same, just different domains and url's:
And the catch all irule:
when HTTP_REQUEST {
if { [HTTP::host] contains "alfasite.se" } {
HTTP::respond 301 location "https://www.existingsite.se/alfa/alfasite/" }
if { [HTTP::host] contains "alfasite.com" } {
HTTP::respond 301 location "https://www.existingsite.com/alfa/alfasite/" }
if { [HTTP::host] contains "betasite.se" } {
HTTP::respond 301 location "https://www.existingsite.com/beta/betasite/" }
if { [HTTP::host] contains "betasite.com" } {
HTTP::respond 301 location "" }
}
In my staging environment i can only get on of the array irules to work. Some times its alfasite, sometimes it's betasite. The iRule order does not seem to matter. When it does not work, it look's like it does not hit the repsective array irule, but only the catchall.
Any ideas?