Forum Discussion
VFB
Apr 20, 2021Cirrus
Redirect rewrite iRule
I'm trying to craft an irule to do the following: If user hits site-1 and has /europe/[HTTP::uri], redirect him to site-2, remove /europe and add /america, and append trailing URI of the initial requ...
- Apr 20, 2021
Hi VFB,
You can use string map for string replacement.
https://devcentral.f5.com/s/articles/irules-101-14-tcl-string-commands-part-2
when HTTP_REQUEST { if { [HTTP::host] equals "www.site-1.com" && [HTTP::uri] starts_with "/europe/" } { HTTP::redirect "https://www.site-2.com[string map {/europe/ /america/} [HTTP::uri]]" return } }
Apr 20, 2021
Hi VFB,
You can use string map for string replacement.
https://devcentral.f5.com/s/articles/irules-101-14-tcl-string-commands-part-2
when HTTP_REQUEST {
if { [HTTP::host] equals "www.site-1.com" && [HTTP::uri] starts_with "/europe/" } {
HTTP::redirect "https://www.site-2.com[string map {/europe/ /america/} [HTTP::uri]]"
return
}
}
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects