Hi ,
You can try below iRule -
when HTTP_REQUEST {
if { [HTTP::host] equals "example1.com" }{
if { [HTTP::uri] contains "something" }{
HTTP::redirect "https://example2.com"
}
}
}
Also below is the irule which will also help to redirect to the uri along with the host. So you shouldn't require separate irule to redirect to the uri if you want to keep same uri path.
when HTTP_REQUEST {
if { [HTTP::host] equals "example1.com" }{
if { [HTTP::uri] contains "something" }{
HTTP::redirect "https://example2.com[HTTP::uri]"
}
}
}
Also if your F5s are running on 14.1.0 or later version, kindly consider - https://support.f5.com/csp/article/K23237429
Hope it helps!