URL Replace iRule

Hi,

I am hosting a website behind my LB, with URL replacement requirement as below:

https://www.somesite.com/SearchResult.aspx/?search=

Should redirect to

https://somesite.com/somejsppage.jsp?kw=

Can you please help me with iRule formation for this requirement?

I tried redirect rule, but that doesnt pick the last and it redirects without it. I need to have partnumber from old URL to the new one, but change the URL prior to that.

Any help would be appreciated.

Thanks

https://www.somesite.com/SearchResult.aspx/?search=

Should redirect to

https://somesite.com/somejsppage.jsp?kw=

is part of the sample url missing?

anyway, is it something like this?

// config

[root@ve11a:Active:In Sync] config  tmsh list ltm virtual bar
ltm virtual bar {
    destination 172.28.24.10:80
    ip-protocol tcp
    mask 255.255.255.255
    pool foo
    profiles {
        http { }
        tcp { }
    }
    rules {
        qux
    }
    source 0.0.0.0/0
    source-address-translation {
        type automap
    }
    vs-index 60
}
[root@ve11a:Active:In Sync] config  tmsh list ltm rule qux
ltm rule qux {
    when HTTP_REQUEST {
  if { [HTTP::host] eq "www.somesite.com" } {
    if { [HTTP::uri] starts_with "/SearchResult.aspx/?search=" } {
      HTTP::redirect "http://somesite.com/somejsppage.jsp?kw=[URI::query [HTTP::uri] search]"
    }
  }
}
}

// test

[root@ve11a:Active:In Sync] config  curl -I http://172.28.24.10/SearchResult.aspx/?search=something -H "Host: www.somesite.com"
HTTP/1.0 302 Found
Location: http://somesite.com/somejsppage.jsp?kw=something
Server: BigIP
Connection: Keep-Alive
Content-Length: 0