Forum Discussion
Damion_19248
Nimbostratus
Feb 02, 2013Remove trailing slash
I need to remove any trailing slashes off any url that come in.
www.mydomain.com/category/ - -> www.mydomain.com/category
www.mydomain.com/place/ --> www.mydomain.com/place
etc ...
Kevin_Stewart
Employee
Feb 04, 2013Sorry, the above would actually break the app if the URI was simply "/". Try this instead:
when HTTP_REQUEST {
if { not ( [HTTP::uri] equals "/" ) and ( [HTTP::uri] ends_with "/" ) } {
HTTP::uri [string trimright [HTTP::uri] "/"]
}
}
The browser automatically adds the trailing slash if you only enter the host name so the BIG-IP will always see, at a minimum, the single trailing "/".
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