Forum Discussion
markmill
Nimbostratus
May 30, 2020Combine URI::path and URI:basename in single TCL command string
I have a uri /dir1/dir2/dir3/filename.ext where I would like to replace/strip the first directory e.g. /dir2/dir3/filename.ext before forwarding on the request. I have been using the following, but I...
cjunior
Nacreous
Jun 04, 2020Hi,
Is the /dir1 a fixed name?
If so, you can simply skip that name length:
tcl:[string range [HTTP::uri] 5 end]
Otherwise, you can work with variables or try this single line:
tcl:[URI::path [HTTP::uri] 2][URI::basename [HTTP::uri]][expr { \"[URI::query [HTTP::uri]]\" eq {} ? {} : \"?[URI::query [HTTP::uri]]\" }]
I hope it helps.
Regards
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