Irule to amend URI

Hi,

I’m looking to do something like this: https://www.mysite.com/path/search?SomeDynameicText rewrite to something like this https://www.mysite.com/path/search/v1?SomeDynameicText

I have got the following, but it doesn;t seem to work

when HTTP_REQUEST {
    if { [HTTP::uri] contains "/search?" } {
        HTTP::redirect "https://[HTTP::host]/search/v1?[HTTP::uri]"
    }
}

sorted by using [HTTP::query]

when HTTP_REQUEST {
    if { [HTTP::uri] contains "/search?" } {
        HTTP::redirect "https://[HTTP::host]/search/v1?[HTTP::query]"
    }
}