How to prevent bandwidth theft using .htaccess deny referer

If you are receiving lots of SPAM from visitors referred from a specific domain, you can use this little code snippet on your website.

By blocking access by referer, you are making your website unavailable to anyone coming to your site from a specified domain. For example, if you are receiving tons of fake “hits” from a specific website, you can insert this on your .htaccess file


RewriteEngine on
RewriteCond %{HTTP_REFERER} badsite.com [NC]
RewriteRule .* – [F]

Just replace the “badsite.com” with the actual website in question.

Leave a Reply

Your email address will not be published. Required fields are marked *