Forum Discussion

Mohan_Kumar_321's avatar
Mohan_Kumar_321
Icon for Nimbostratus rankNimbostratus
Jun 21, 2018
Solved

iRule for uri redrect

Would you mind please verify below iRule for redirecting the traffic which is going to "/career " redirect to https://jobs.abcd.com

 

if { [HTTP::uri] equals "/careers" } { HTTP::redirect "https://jobs.abcd.com"; }

 

Does it work?

 

Any help with this will be greatly appreciated..!!

 

Thank you..!!

 

  • Issue got fixed with below iRule.

     

    when HTTP_REQUEST { if { [HTTP::uri] equals "/careers" } {

     

    HTTP::respond 301 Location ";;

     

    } }

     

    Thank you Stanislas for all your support..!!

     

    Regards, Mohan

     

2 Replies

  • I should recommend to do it with a policy instead of irule!

    Your code may work but I would recommend to :

    Filter on HTTP::path instead of HTTP::uri

    Use starts_with instead of equals if you want to catch all subdirectories of /careers

  • Issue got fixed with below iRule.

     

    when HTTP_REQUEST { if { [HTTP::uri] equals "/careers" } {

     

    HTTP::respond 301 Location ";;

     

    } }

     

    Thank you Stanislas for all your support..!!

     

    Regards, Mohan