You have a couple of options with URL rewriting. In your case, if you want to maintain the original hostname, then all you'll have to do is modify the Host HTTP header in the HTTP_REQUEST event on it's way to the backend pool of servers. Something like this should do it:
when HTTP_REQUEST {
if { [HTTP::header "Host"] eq "FarmA" } {
HTTP::header replace "Host" "FarmB"
}
}
If you configure this iRule on your FarmA virtual, it will make the uri "
http://FarmA/*" look to the backend servers like it is "
http://FarmB/*".
Hope this helps.
-Joe