norrtom_376408
Nov 21, 2018Nimbostratus
Can someone help me with iRule redirects?
Hi All!
I am new to F5 and iRules. I'm helping out a client of mine to do redirections.
I understand that if I want to redirect several URL's from an old domain to a new one, i will do as this:
when HTTP_REQUEST {
if { [string tolower [HTTP::host]] eq "www.old-example.com" and [HTTP::path] eq "/my-old-path/page-y" } {
HTTP::respond 301 Location "https://www.new-example.com/new-path/page-x"
}
if { [string tolower [HTTP::host]] eq "www.old-example.com" and [HTTP::path] eq "/my-old-path-2/page-zz" } {
HTTP::respond 301 Location "https://www.new-example.com/new-path-2/page-zzy"
}
if { [string tolower [HTTP::host]] eq "www.old-example.com" and [HTTP::path] eq "/my-old-path-n/old-page-n" } {
HTTP::respond 301 Location "https://www.new-example.com/new-path-n/new-page-n"
} }
Can some of you experts out there confirm that the rules above are correct for simple redirections?
Since I will also need to do wildcard redirections as in redirected to , can you help me out with a basic redirect rule for regex redirections?
The wildcard redirections will always have some numbers in the end (page) that change, but else it will always be a quite static slug. Can you help me?
Thank you so much for your time!
Br, Tom