Forum Discussion
Rico
Dec 17, 2018Cirrus
ras,
From my understanding, the iRule you are requesting ignores 'abc' and 'itg' so I have no included any handling for that in my example code. This iRule will only activate if the uri has more than one slash and if it doesnt end with a slash to prevent calculation errors.
when HTTP_REQUEST
{
if {([string trimleft [HTTP::path] "/"] contains "/") and not ([HTTP::path] ends_with "/")}
{
set uri_list [split [HTTP::path] /]
set orig_uri [lindex $uri_list 1]
set uri_elements [split $orig_uri -]
set new_uri [lindex $uri_elements 1]/[lindex $uri_elements 2]
lset uri_list 1 $new_uri
log local0. [join $uri_list /]
HTTP::uri [join $uri_list /]
}
}
Hope this helps.