Forum Discussion
lawrence_Wickli
Nimbostratus
Jun 27, 2006Matchng a specific directory.
Hello all,
I am trying to match a specific directory and redirect apropriately without using regex rules. Here is what I have so far:
if { [string tolower [HTTP::uri]] starts_with "/about_us" } {
pool p_http_aboutus
I need it to ignore case and I need it to be limited to just the first /about_us directory and /about_us/ and not /about_us1 etc.
I have multiple of these to parse so I am considering a class to help but right now I just need to limit it to exactly the directories I need with out the wildcard on the back side.
Any recomendation on how I should approach this?
- Deb_Allen_18Historic F5 AccountYou could use getfield to extract the first directory regardless of trailing slash:
getfield splits the first parameter into fields delimted by the character in the 2nd parameter, and returns the field requested in the 3rd, starting at index 1. Since a URI always starts with a "/", field 1 is blank and field 2 contains the name of the first directory in the URI.if { [getfield [string tolower [HTTP::uri]] "/" 2] equals "about_us" } { pool p_http_aboutus }
- lawrence_Wickli
Nimbostratus
So what I have ended up with is - This is likely the fastest you are going to get.
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