iRule redirect

I would like to do the following redirect via an iRule.

Redirect * to *

I have created the following iRule and added to the VS resources but it does not work. Any help would be appreciated as I am a total novice here!

when HTTP_REQUEST { if { [HTTP::host] starts_with “ensemble-sp1/” && [HTTP::uri] contains “/sites/PMIS/*”} {

HTTP::redirect "http://cindy-uat/*[HTTP::uri]"

} }

You can try something like this:

when HTTP_REQUEST { 
    if { ([string tolower [HTTP::host]] starts_with "ensemble-sp1") && ([string tolower [HTTP::uri]] contains "/sites/PMIS/" ) } { 
         the following command will find the string /sites/PMIS/ and will return all characters after 
         that string until it hits either an & or the end of the string,
        HTTP::redirect "http://cindy-uat/[findstr [HTTP::uri] "/sites/PMIS/" 12 &]"
    }
}

I haven’t actually tested this, but it should be a good starting point for you.