Forum Discussion
Jeff_Barnett_41
Nimbostratus
Dec 24, 2014URL redirect to another
I am new to the F5 I need to create a simple Irule that redirects one URL to another. here is what I have, that does not work:
when HTTP_REQUEST {
if { (([HTTP::host] equals "abc.com/sonar"))...
mimlo_61970
Cumulonimbus
Dec 24, 2014HTTP::host will never match abc.com/sonar, it would only match abc.com You need to use HTTP::host to match the host, and HTTP::uri to match the path.
when HTTP_REQUEST {
if { (([string tolower [HTTP::host]] equals "abc.com") and ([string tolower [HTTP::uri]] equals "/sonar")) {
HTTP::redirect "https://abc.com/sonar/sessions/new?return_to=%2Fsonar%2F"
} else {
HTTP::redirect https://[HTTP::host][HTTP::uri]
}
I think that should world. You can also do this with an HTTPClass or policy(depending on your LTM version) instead of an iRule.
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