Forum Discussion
Nov 14, 2009
NOT start with
Hello All,
Does anyone know the syntax for using "NOT start with" when doing a comparison with the URI?
ex)
This should do a 301 redirect if the URI does NOT start with "/Solutions Guide" and
starts with "Solutions" or "solutions"
if { !([HTTP::uri] starts_with "/Solutions Guide") and (([HTTP::uri] starts_with "/Solutions") or
([HTTP::uri] starts_with "/solutions")) } {
HTTP::respond 301 Location "http://[HTTP::host]/erp/Solutions"
log local0. "------301 redirect to Solutions VCM page.-----"
return
}
This code above does NOT work for some reason. What am I doing wrong?
Thanks!
Regards,
TRX
- The_Bhattman
Nimbostratus
instead of "!" you can use "NOT" - hoolio
Cirrostratus
Hi Trx,when HTTP_REQUEST { Check the requested URI switch -glob [HTTP::uri] { /[sS]olutions { log local0. "[IP::client_addr]:[TCP::client_port]: Matched /solutions check." if {! ([HTTP::uri] starts_with "/Solutions%20Guide") }{ log local0. "[IP::client_addr]:[TCP::client_port]: Did not match /Solutions%20Guide" HTTP::respond 301 Location "http://[HTTP::host]/erp/Solutions" } } } }
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