Forum Discussion
giorgio_32761
Nimbostratus
Dec 21, 2018URI Manipulation
Hi, I would like to extract part of a URI, from the 5th "/" to the end, for example:
/string1/string2/string3/string4/something/seomethingelse/
should become:
/something/somethingelse ...
Rico
Cirrus
Dec 21, 2018Giorgio,
Here is an iRule I wrote to be a more efficient solution. Based on what I understand, it seems like you simply want to eliminate the first four items of the URI. I found a simple TCL command that will allow you to replace the undesired elements, effectively removing them. This will allow you to create the URI you want in a bit more optimized way. If there is a modification you want or questions about the iRule, I am sure I can help.
when HTTP_REQUEST
{
set uri_list [split [HTTP::uri] "/"]
if {[llength $uri_list] > 5}
{
set new_uri_list [lreplace $uri_list 0 4 ""]
HTTP::uri [join $new_uri_list "/"]
}
}
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