Hello,
I am trying to do a 301 redirect to a new URL while rewriting a sub string within the original URI on a LTM using an iRule. Here is the simplified example of what I am trying to accomplish:
Original URL - .xyz Domain Names | Join Generation XYZ*
301 Redirect URL - tuv.com/123/456/*
The wildcard sting after the sub string I want to replace must remain the same between the original URL and the 301 URL.
This is what I have written up for an iRule:
when HTTP_REQUEST {
if { [HTTP::uri] contains "/abc/efg" } {
[HTTP::host] replace "tuv.com"
[HTTP::uri] replace [string map -nocase {"/abc/efg" "/123/456"} [HTTP::uri]]
HTTP::respond 301 "https://[HTTP::host][HTTP::uri]"
}
}
Thanks in advance and any advise is greatly appreciated.