Showing results for 
Search instead for 
Did you mean: 
Login & Join the DevCentral Connects Group to watch the Recorded LiveStream (May 12) on Basic iControl Security - show notes included.

How to remove from path first segment on F5


Hello I have problem to implement solution as above in topic.


I have URL: and I want from path remove first segment "en-gb" and put rest of the path to redirect



if { ([string tolower [HTTP::path]] starts_with "/en-gb")

HTTP::redirect " [string tolower [URI::path [HTTP::uri] 2]]"




Problem is that URI::path is not working and F5 probably is not reading it as function (HTTP has purple color, so it is correct).

Is it possible to do it in different way to manipule segments belong to path variable?


F5 Employee
F5 Employee

Well, you have a problem with the syntax of the if conditional, so this breaks the parsing of the TCL and the syntax highlighting.

Also, your HTTP::redirect target is wrong - you will end up with a space in the location, which is not legal.


As always, start with some logging ...

when HTTP_REQUEST { log local0. "path is [string tolower [HTTP::path]]" if { ([string tolower [HTTP::path]] starts_with "/en-gb") } { log local0. " uri is [string tolower [HTTP::uri]], path from 2nd element is [string tolower [URI::path [HTTP::uri] 2]]" HTTP::redirect "[string tolower [URI::path [HTTP::uri] 2]]" } }