Forum Discussion
Monty_152734
Apr 04, 2017Nimbostratus
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.c...
JG
Apr 05, 2017Cumulonimbus
Try this one:
when HTTP_REQUEST {
log local0. "URI in: [HTTP::uri]"
if { ([string tolower [HTTP::path]] starts_with "/shop/window.yes") and \
([string tolower [URI::query [HTTP::uri]]] equals "car=false")} {
log local0. "Matched: Path: [HTTP::path]; Query: [URI::query [HTTP::uri]]"
HTTP::redirect "/shop/door.yes?car=true"
}
if { [string tolower [HTTP::path]] starts_with "/shop/" } {
log local0. "Not matched: Path: [HTTP::path]; Query: [URI::query [HTTP::uri]]"
pool example-pool
persist none
}
}
[Edited to include logging.]
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects