Forum Discussion
Sunder
Nimbostratus
Aug 25, 2020How to remove from path first segment on F5
Hello I have problem to implement solution as above in topic. I have URL: https://1234.com/en-gb/cat/dog and I want from path remove first segment "en-gb" and put rest of the path to redirect ...
Simon_Blakely
Employee
Aug 25, 2020Well, 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 "https://1234.com/london/en-gb/apps/tickets[string tolower [URI::path [HTTP::uri] 2]]"
}
}
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