Forum Discussion
How do I combine multiple irules doing redirects to a single irule?
Hi all
Has someone worked on a similar set i=of irules?
I currently have 2 separate irules to redirect users to a specific page; however, I would like to create a single rule that combines into 1 irule.
Rule 1
when HTTP_REQUEST { if {[HTTP::host] equals "infogood" and ([HTTP::uri] equals "/cu/en/legacylogin.jsp" or [HTTP::uri] equals "/cu/en/legacylogin.jsp/")} { HTTP::redirect "http://www.school.com/it/" } elseif {[HTTP::host] equals "education-account-identification.com" } { HTTP::redirect "http://www.school.com/it/" } }
Rule 2
when HTTP_REQUEST { {[HTTP::host] equals "www.schoolpermit.com"} { HTTP::redirect "http://www.school.com/it/" } }
Now, I tried to combine them with an "else" switch and dropping the "when HTTP_REQUEST on irule 2 but I get errors loading the irule.
Also, should I add the "string tolower" switch?
2 Replies
- Michael_Jenkins
Cirrostratus
Try something like this.
when HTTP_REQUEST { switch [string tolower [HTTP::host]] { "www.infogood.com" { switch [string tolower [HTTP::uri]] { "/cu/en/legacylogin.jsp" - "/cu/en/legacylogin.jsp/" { HTTP::redirect "http://www.school.com/it/" } } } "education-account-identification.com" { HTTP::redirect "http://www.school.com/it/" } "www.schoolpermit.com" { HTTP::redirect "http://www.school.com/it/" } } } - chungyu_16122
Altostratus
Hi Michael
Thanks a lot, I will try this out and post the results.
Regards
Chung
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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