Forum Moderators: phranque
<FilesMatch "(.*)">
Order Allow,Deny
Allow from all
Deny from env=spam_ref
</FilesMatch>
what would i do to add more than one? repeat the referer line "referer"^http..." and change it to spam-ref=2?
cheers:)
what would the mode_rewrite be for banning people from a certain refferer?
Just add as many SetEnvIf directives as you like; They are effectively ORed together, since any one of them can "set" the variable. Note that you do not have to assign a value to the variable at all -- it will be set to logical "true" by default. Also, remember to "escape" the literal characters in the regex string by preceding them with a backslash:
SetEnvIfNoCase Referer "^http://www\.sitethatiwantotblockreferresfrom\.com" spam_ref
SetEnvIfNoCase Referer "^http://www\.othersitethatiwantotblockreferresfrom\.com" spam_ref
SetEnvIfNoCase Referer "^http://www\.yetanothersitethatiwantotblockreferresfrom\.com" spam_ref
The mod_rewrite code takes a similar form:
RewriteCond %{HTTP_REFERER} ^http://www\.sitethatiwantotblockreferresfrom\.com [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://www\.othersitethatiwantotblockreferresfrom\.com [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://www\.yetanothersitethatiwantotblockreferresfrom\.com [NC]
RewriteRule !^yourcustom403page\.html$ - [F]
Ref: Introduction to mod_rewrite [webmasterworld.com]
Jim