Here's one option for companies "compA", "compB", and "compC". You can modify/expand this by replacing/adding new company names to the switch statement.
when HTTP_REQUEST {
switch -glob [HTTP::uri] {
"/compA*" -
"/compB*" -
"/compC*" {
set comp variable to first sub dir of in uri.
set comp [getfield [HTTP::uri] "/" 2]
perform a string map from the found string to "global" in the URI.
set newuri [string map [list $comp "global"] [HTTP::uri]]
Issue a HTTP redirect to the client browser
HTTP::redirect $newuri
Modify the URI sent to the backend server
HTTP::uri $newuri
}
}
}
You have two options in changing the URI. You can issue a redirect to the client browser with the HTTP::redirect command. Or you can just modify the URI that is sent to the backend server. comment/uncomment the one that you desire.
Now, if you have a large number of company names, you may want to move to a data group/matchclass solution. If that's the case, let me know and I'll work out an iRule for you.
Hope this helps...
-Joe