Forum Discussion
gbunting
Nimbostratus
Jun 18, 2013Need help creating iRule to do redirects based on uri
Hi,
I need to create an iRule that will match this url:
http://mywebsite.com/SEC+TEST/{x}/{y}.htm
where {x} and {y} can be anything. This should redirect to:
...
nitass
Employee
Jun 19, 2013another one. 🙂
[root@ve10:Active] config b rule myrule list
rule myrule {
when HTTP_REQUEST {
if { [HTTP::uri] starts_with "/SEC+TEST/" } {
if { [scan [HTTP::uri] {/SEC+TEST/%*[^/]/%[^.].htm} y] == 1 } {
HTTP::redirect "http://myotherwebsite.com/folder1/folder2/KB/redirect.aspx?id=$y"
}
}
}
}
[root@ve10:Active] config curl -I http://172.28.19.252/SEC+TEST/987654321abc/xyz123.htm
HTTP/1.0 302 Found
Location: http://myotherwebsite.com/folder1/folder2/KB/redirect.aspx?id=xyz123
Server: BigIP
Connection: Keep-Alive
Content-Length: 0
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