Forum Discussion
David_Stephenso
Nimbostratus
Oct 12, 2011iRule URL redirect help required.
Hi, I am quite new to iRules. The only rules that I have worked with so far are simple uri redirects. We would like this example URL to be redirected from: http://link.ecm.tn.e...
Colin_Walker_12
Oct 14, 2011Historic F5 Account
Cool, then this shouldn't be horrible. You'd need something like:
when HTTP_REQUEST {
if {[scan [HTTP::uri] "/%d&%s" dnum action] == 2} {
HTTP::redirect "http://link.ecm.tn.exp/Livelink/livelink.exe?func=LL.login&username=Anonymous&password=&NextURL=%2FLivelink%2Flivelink%2Eexe%3Ffunc%3Dll%26objId%3D$dnum%26objAction%3D$action"
} else {
log local0. "URI: [HTTP::uri] did not match"
}
}
Keep in mind that this will match any URI with /& format, and if you want to do some more specific checking you could analyze the dnum and action variables once they were set by the scan command to see if the action matches an appropriate action or something to that effect, but it sounds like the URI is something you're controlling anyway, so I wasn't horribly worried about that.
Let me know if that works, and/or if you have any further questions.
Colin
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
