Forum Discussion
Enable compression of two or more adjacent slashes in a URI into a single slash.
Nginx has a merge_slashes module that will evaluate a URI like "/foo; and change it to "/foo/bar/foobar?slashes=many". But our IIS websites just display the browser URL the way the user input it: Our Google Analytics team sees these as unique pages in GA and want us to catch all adjacent slashes in a request and redirect it to the standard of one slash at a time. My irule tries have lead to redirect loops so I'm asking for someone's time and genius to help me out.
- rob_carr
Cirrocumulus
Have you looked at using the string map function against the URI?
 
- crodriguezRet. Employee
You might be able to use something like this:
when HTTP_REQUEST { if { [HTTP::uri] contains "//" } { set URIquals [split [HTTP::uri] "/"] set newURI "" foreach qual $URIquals { if { $qual ne "" } { append newURI "/" $qual } } HTTP::uri $newURI } }
I ran a small test using your input string above:
Before URI: /foo
After URI: /foo/bar/foobar?slashes=many
Recent Discussions
Related Content
* 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