正则表达式非常强大。这个例子可以检查一个参数是否是在0到99999之间的整数:
SecFilterSelective ARG_parameter "!^[0-9]{1,5}$"
禁止对一个应用程序上传文件,但是可以上传到一个子目录里:
# Reject
requests with header "Content-Type" set
# to "multipart/form-data"
SecFilterSelective HTTP_CONTENT_TYPE multipart/form-data
# Only for the script that performs upload
<Location
/upload.php>
# Do not inherit filters from the parent folder
SecFilterInheritance Off
</Location>
早期版本的FormMail可能被滥用,发送email给任意收件人(我被告知有新版可以避免这个问题)。
# Only for the FormMail script
<Location
/cgi-bin/FormMail>
# Reject
request where the value of parameter "recipient"
# does
not end with "@webkreator.com"
SecFilterSelective ARG_recipient "!@webkreator.com$">
</Location>