Forum Discussion

Monty_152734's avatar
Monty_152734
Icon for Nimbostratus rankNimbostratus
Apr 04, 2017

Redirect on multiple conditions URI & Query

Hi Guys, This is my first time at DevCentral.

 

I need help. The requirement are when f5 see URI ( https://abc.xyz.com/shop/window.yes) and query (car=true) then redirect to url (https://abc.xyz.com/shop/door.yes?car=ture) if query car=false do nothing.

 

means if some try https://abc.xyz.com/shop/window.yes?car=ture url should redirect to https://abc.xyz.com/shop/door.yes?car=ture

 

here is a irule what I am using but it is not working, can someone tell me what is wrong.

 

when HTTP_REQUEST { if { [string tolower [URI::query [HTTP::uri] "cart" ] ] equals "true" } { switch -glob [string tolower [HTTP::path]] { "/shop/window.yes*" { HTTP::redirect "[HTTP::host]/shop/door.yes?[HTTP::query]" } } } }