Forum Discussion
Bob_10976
Nimbostratus
Mar 25, 2010Rewrite rule not working, what am I missing?
I have this iRule that works fine, with the exception of the last entry, which I can't seem to get to take. This is assiged to our MOSS farm, so we have several web sites under one pool. I added the...
Bob_10976
Nimbostratus
Mar 25, 2010Wow..sweet, I did actually get it to work using elseif statements, but I like how you've done this. The only question I have is how do you break out of the -glob flag. Is it as simple as what I did when I added domain8.com at the bottom, or should I adding those type of domains before the -glob flag?
when HTTP_REQUEST {
switch "[string tolower [HTTP::host]]" {
"domain1.com" -
"www.domain1.com" {
HTTP::respond 301 Location "http://domain2.com
}
"domain3.com" -
"www.domain3.com" {
HTTP::respond 301 Location "https://domain3-edit.com
}
"www.domain4.com" {
HTTP::respond 301 Location "http://domain4.com/"
}
"domain5.com" {
HTTP::respond 301 Location "https://domain5-edit.com/"
}
"www.domain6.com" {
HTTP::respond 301 Location "http://domain6.com/"
}
"www.domain7.com" {
HTTP::respond 301 Location "http://domain7.com/"
}
"domain7.com" {
switch -glob "[string tolower [HTTP::uri]]" {
"/security" {
"/security/" -
Exact match for "/security" or "/security/"
HTTP::respond 301 Location "http://domain7.com/ciso/pages/services.aspx"
}
"/urib*" {
URI starts with "/urib"
HTTP::respond 301 Location "http://domain7.com/ciso/pages/urib.aspx"
}
"*uric" {
URI ends with "uric"
HTTP::respond 301 Location "http://domain7.com/ciso/pages/uric.aspx"
}
"*uri[d-f]" {
URI ends with "urid", "urie" or "urif"
HTTP::respond 301 Location "http://domain7.com/ciso/pages/uric.aspx"
}
"*uri?" {
URI ends with "uri" and any other character (which hasn't already been matched like b, c, d-f)
HTTP::respond 301 Location "http://domain7.com/ciso/pages/uric.aspx"
}
"www.domain8.com" {
HTTP::respond 301 Location "http://domain8.com/"
}
}
}
}
}
Thanks again this his very helpful...
Bob
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