looking at your rule if{[string length [substr {HTTP::uri] 0 "?"]]>0} this rule is always going to be true since the first character on a HTTP::uri is always "/" therefore the string lengh will always be greater than 0
may be you want to do if{[string length [substr {HTTP::uri] 1 "?"]]>0} this will start the string length after the first character of HTTP::uri which is always "/"
set VAR1 "/downloads/hector/file1?V12"
set VAR2 [substr [VAR1] 0 "?"]
VAR2 will be equal to /downloads/hector/file1
the substr command will start at the beginning and will end when the "?" is matched
another example
set VAR3 "/downloads/hector/fil?v13?hello"
set VAR4 [substr [VAR1] 0 "?"]
VAR3 is equal to /downloads/hector/fil
set VAR5 [[substr [VAR1] 5 "?"]
VAR5 is equal loads/hector/fil
the substr