Hi @Herrmann_Hinz,
redir
has an if_op
subdirective which tells it how to chain conditionals. By default the operator is AND, but you can change it to OR.
The following example permanently redirects to example.com
if the foo
request header has either bar
or xyz
in it:
redir 301 {
if_op or
if {>foo} has bar
if {>foo} has xyz
/ example.com
}
For statements like if {>User-Agent} not_has "B.iCycle*"
, though, you’ll want to use match
to evaluate a regex string instead - not_has
is a substring search and doesn’t do wildcards like *
. Better still would be to wait for the not_starts_with
conditional, which is still a substring search but anchored to the start of the string (much faster than regex).
Also, one other trap to look out for - multiple not_has
in an OR chain would logically allow all requests through if the substrings you’re checking for are different;
redir 301 {
if_op or
if {>foo} not_has bar
if {>foo} not_has xyz
/ localhost
}
# foo = bar; redirected to localhost (satisfies "not_has xyz" condition)
# foo = xyz; redirected to localhost (satisfies "not_has bar" condition)