aFlex to Change URI Case in a certain location

Posted by TODDH

We have a very simple aflex that we currently us to convert the entire uri to lower case:

when HTTP_REQUEST {
HTTP::uri [string tolower [HTTP::uri] ]
}

We need to modify that aflex so that it only executes the “tolower” to a portion of the uri. The portion of the uri that we need to convert to lower case is the top-most hierarchy in the path name.

For example, if we have an HTTP request for

example.com/FUN/AUSTIN.html

We want to convert it to

example.com/fun/AUSTIN.html

Similarly, if we have an HTTP request for

example.com/FUN/TEXAS/AUSTIN.html

we want to convert it to

example.com/fun/TEXAS/AUSTIN.html

Let us know if this is something that you think would be possible to do!

Comments

  • edited February 2014
    Posted by TODDH

    This was written by our incredible staff.

    I have tested this in the lab and it works like a champ.


    when HTTP_REQUEST {
    set uri [HTTP::uri]
    HTTP::uri [string tolower $uri 1 [string first $uri 2]]
    }
Sign In or Register to comment.