Forum Discussion
redirect path irule f5
Hello!
I have three hosts ( www.abc.com /.www.aze.fr / www.qsd.fr ) with the same path and i want redirect all the paths to a new path for all hosts
My irule:
when HTTP_REQUEST {
if {
[HTTP::path] contains "/abcd"
or [HTTP::path] contains "/yyyyyyy"
or [HTTP::path] contains "/xxxxxx"
or [HTTP::path] contains "/zzzzzz"
...
}
{
HTTP::redirect "/fin_participations.html"
}
}
But my irule it's not good, have you suggestions to achieve my goal please!!
Thank you ^_^
Hi mika,
when HTTP_REQUEST { if { [string tolower [HTTP::uri]] ne "/fin_participations.html" } { HTTP::redirect "http://www.abc.com/fin_participations.html" } }
- mika
Cirrus
thank you for your reply, but I cannot apply this rule because I have another url with the same hosts that I don't want to redirect to this page, i want redirect just some path not all.
You can use switch statement or datagroup.
Switch:
when HTTP_REQUEST { switch -glob [HTTP::path] { "/abcd*" - "/yyyyyyy*" - "/xxxxxx*" - "/zzzzzz*" { HTTP::redirect "http://[HTTP::host]/fin_participations.html" } } }
Datagroup:
Create a string datagroup.
/abcd /yyyyyyy /xxxxxx /zzzzzz
Datagroup irule:
when HTTP_REQUEST { if { class match [HTTP::path] contains dg-name } { HTTP::redirect "http://[HTTP::host]/fin_participations.html" } } }
LTM policy will be better option to use here.
Mayur
- mika
Cirrus
Hello, thank u for your reply, i created a datagroup which contains all path, and i used
LTM Policy refer attached image but i have the same probleme.
Best regards
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