Redirect requests
Im using that rule
^(?!webmaster)[\w\/\d\_\-\:\;\?\=\.]+$
to match all request which a开发者_如何学编程re different of webmaster. How to match request which are different of webmaster OR some_other_dir ?
?
Try
^(?!(?:webmaster|SomeOtherDir))[\w\/\d\_\-\:\;\?\=\.]+$
The (?:webmaster|SomeOtherDir)
is a non capturing group and the |
is a "OR"
You can also simplify your character group, within a character group most characters don't need to be escaped, the -
has to be at the beginning or the end (or needs escaping) otherwise it defines a character range, so I moved it to the end. The _
is included in \w
so does not need to be listed. (I am not sure about the /
, so I leave it as it is)
^(?!(?:webmaster|SomeOtherDir))[\w\/\d:;?=.-]+$
精彩评论