Assuming you know the vendor name variable, you can do something like this:
set vendor "vendorName"; assign from header or some other input
if { [HTTP::uri] starts_with "/${vendor}?" } {
HTTP::uri [string map [list "/${vendor}?" "?${vendor}&"] [HTTP::uri]]
}
If you want to look for all patterns and of "/?" and replace it, you can do so with something like this
if { ([HTTP::uri] starts_with "/") && ([HTTP::uri] contains "?") } {
Find the index of the "?" character
set idx [string first "?" [HTTP::uri]]
extract the string from index 1 up to the character before the "?"
set site [string range [HTTP::uri] 1 [expr $idx - 1]]
Modify the URI with the string replacement.
HTTP::uri [string map [list "/${site}?" "?${site}&"] [HTTP::uri]]
}
Keep in mind that this isn't bulletproof. So make sure the logic fits for all of your URLs.
-Joe