Forum Discussion
DM_5174
Nimbostratus
Jun 09, 2008Formatting irule from 4.x to 9.x question
Hi All,
What I have below is an i-rule i created for the bigip version 4.x, however when I tried to format this to work on
the 9.x platform I'm having issues with the regular expression converstion and don't know what the syntax for 9.x is.
If anyone can provide any guidance and feedback, this would be greatly appreciated.
if (http_host == "www.abc.com" and http_uri matches_regex "/[pP][oO][rR][tT][aA][lL]") {
redirect to "www.new-redirect.com/portal/index.html"
}
else {
use pool WEBSERVER_POOL
}
Thanks!
4 Replies
- hoolio
Cirrostratus
Here is a 9.x equivalent:when HTTP_REQUEST { if {[string tolower [HTTP::host]] eq "www.abc.com" and [string tolower [HTTP::uri]] eq "/portal") { HTTP::redirect "www.new-redirect.com/portal/index.html" } else { pool WEBSERVER_POOL } }
Aaron - Andy_Herrman_22
Nimbostratus
Well, I'm guessing the rule as you defined it there is going to error out. You're using parens () instead of curly braces {} around the if clause.
Does that help at all? - DM_5174
Nimbostratus
Hi Aaron,
The "portal" should not be case-sensitive, i.e. so if a user connects with http://www.abc.com/PoRtAl using mix case letters (capital and lowercase) they should get redirected to the new url. Will this work? or do i need to use the following code below?
if { [regexp -nocase {^/portal} [HTTP::uri]] } {
Thanks! - JRahm
Admin
The string tolower will strip case so the regex is unnecessary.
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
