Forum Discussion
Joe_Pipitone
Nimbostratus
Jan 28, 2010Redirects /rewrites not being caught
I have an iRule written that is supposed to catch the following URL's and redirect them all to https://www.oursite.org
The irule only seems to want to catch the first one, and it is not redirecting / rewriting the ones below that all begin with /Forms
Can anyone help me figure out why it won't catch the others and rewrite properly?
when HTTP_REQUEST {
switch [string tolower [HTTP::path]] {
"/login/default-login.aspx" {
HTTP::redirect "https://www.oursite.org[HTTP::uri]"
}
"/forms/buy.aspx" {
HTTP::redirect "https://www.oursite.org[HTTP::uri]"
}
"/Forms/ChangeForm.aspx" {
HTTP::redirect "https://www.oursite.org[HTTP::uri]"
}
"/Forms/RegistrationForm.aspx" {
HTTP::redirect "https://www.oursite.org[HTTP::uri]"
}
"/Forms/ChangePassword.aspx" {
HTTP::redirect "https://www.oursite.org[HTTP::uri]"
}
"/Forms/RenewForm.aspx" {
HTTP::redirect "https://www.oursite.org[HTTP::uri]"
}
}
}
2 Replies
Sort By
- Joe_Pipitone
Nimbostratus
I figured this out - I had to put everything to lower case and it all worked. - hoolio
Cirrostratus
Nice work. Debug logging could help you catch something like that. Also, if the action is the same for any switch condition, you can combine them into one case:when HTTP_REQUEST { switch [string tolower [HTTP::path]] { "/login/default-login.aspx" - "/forms/buy.aspx" - "/forms/changeform.aspx" - "/forms/registrationform.aspx" - "/forms/changepassword.aspx" - "/forms/renewform.aspx" - HTTP::redirect "https://www.oursite.org[HTTP::uri]" } } }
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