cancel
Showing results for 
Search instead for 
Did you mean: 
Login & Join the DevCentral Connects Group to watch the Recorded LiveStream (May 12) on Basic iControl Security - show notes included.

redirect path irule f5

mika
Cirrus
Cirrus

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 ^_^

 

 

6 REPLIES 6

Hi mika,

when HTTP_REQUEST { if { [string tolower [HTTP::uri]] ne "/fin_participations.html" } { HTTP::redirect "http://www.abc.com/fin_participations.html" } }

 

 

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" } } }

 

I don't know, but it doesn't work 😞 😞

 

LTM policy will be better option to use here.

 

Mayur

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 regards0691T000009hhZlQAI.png