Forum Discussion
BEdmunds_8904
Nimbostratus
Oct 15, 2012so close with an "||" or expression.
I know I am so close to getting this work, and it's so simple...
I need a simple rewrite rule that is activated on certain conditions, I was hoping to use "||" to accomplish this, but I get an error that says :"command is not valid in the current scope" with my existing rule, any thoughts?
when HTTP_REQUEST {
if { ([HTTP:uri] starts_with "/path/to/broken") ||
([HTTP:uri] starts_with "/other/path/broken")
} {
HTTP::redirect "maintenance.html" Note: Modified URL for forum posting.
}
}
So I want the rule to work like if you request site.com/path/to/broken or site.com/other/path/broken, then you are redirected to a maintenance page.
3 Replies
Sort By
- Michael_Yates
Nimbostratus
Hi BEdmunds,when HTTP_REQUEST { if { ([HTTP::uri] starts_with "/path/to/broken") || ([HTTP::uri] starts_with "/other/path/broken") } { HTTP::redirect "maintenance.html" Note: Modified URL for forum posting. } }
- BEdmunds_8904
Nimbostratus
Awesome, thanks for the tip, I will use that for now on. - hoolio
Cirrostratus
A data group is a great option. You could also do this with a switch statement:when HTTP_REQUEST { switch -glob [HTTP::uri] { "/path/to/broken*" - "/other/path/broken*" { HTTP::redirect "/maintenance.html" } } }
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