HTTP::redirect will effectively redirect the client to the new location, and will change the url in the browser. What you need is to replace the host header in the pool side of the connection as described here https://clouddocs.f5.com/api/irules/HTTP__host.html
when HTTP_REQUEST {
# Check if requested host doesn't start with www.example.com
if {not ([string tolower [HTTP::host]] starts_with "www.example.com")}{
# Replace the host header value with newhost.example.com
HTTP::header replace Host "newhost.example.com"
}
}
And to replace the path with another path without redirection, this is described here https://my.f5.com/manage/s/article/K02027845 :
when HTTP_REQUEST {
if { [HTTP::uri] starts_with "/sometext" } {
set uri [string map -nocase {"/sometext" "/newtext"} [HTTP::uri]]
HTTP::uri $uri
}
}