Forum Discussion
Sean_O_Brien_65
Feb 23, 2011Nimbostratus
Looking for iRule to forward based on uri
I have an iRule here:
when HTTP_REQUEST {
if {[HTTP::uri] eq "/proposals/webpagenumber1*" } {
HTTP::redirect "http://domain2.com/Services_and_Products/sub1/sub2/Proposals/webpage1"
}
}
But this isn't working in testing... I have tried using wildcards as shown above and other combinations... but the original page is still being displayed.
I have 10 different uri (pages) from this domain1.com that needed to be redirected to different uri's on domain2.com.
Is there a simpler way to do this? using 'switch' command?
Basically, a bunch of these with different pages:
http://domain1.com/proposals/webpagenumber1.htm
to
http://domain2.com/Services_and_Products/sub1/sub2/Proposals/webpage1
Thanks!
- hooleylistCirrostratusHi Sean,
- Sean_O_Brien_65NimbostratusSo after some more playing, I ended up with this, which works fine:
- hooleylistCirrostratusYou can use a switch statement for this as well. It's more efficient as you're not performing all three checks if a prior check was true.
when HTTP_REQUEST { switch [HTTP::path] { "/proposals/AccessControl.htm" { HTTP::redirect "http://domain2.com/sub1/Construction/Proposals/AccessControl" } "/proposals/Davis.htm" { HTTP::redirect "http://domain2.com/sub1/Construction/Proposals/Maintenance" } default { HTTP::redirect "http://domain2.com/sub1/Construction" } } }
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