Blocking spammers and referrers

Version: 13.2
Revision: 44 Build 66

Blocking spammers and referrers

Introduction:
on the 20th of March, my website was hit by a bunch of clicking robots!
So, I decided to kick them them out of my website and block them from eating my bandwidth.
These traffic are fake and they are doing this to ruin my website and destroy my services for real people and genuine referrals!

1.] Download notepad++ from the original author or from another source.
——————————-

http://sourceforge.net/projects/notepad-plus/

http://filehippo.com/download_notepad/

——————————-

2.] Copy one of these script and save it as a “.htaccess” file.
After that, you will need to delete your old files, which is from your server, then upload your updated version.

Block traffic from a single referrer.
—Copy Source Code—

RewriteEngine On
# Options +FollowSymlinks
RewriteCond %{HTTP_REFERER} ^http://(www\.)?badsite\.net/ [NC]
RewriteRule .* - [F]

—End Source Code—

Block traffic from multiple referrers.
—Copy Source Code—

RewriteEngine On
# Options +FollowSymlinks
RewriteCond %{HTTP_REFERER} ^http://(www\.)?badsite\.net/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(www\.)?badsite\.com/ [NC]
RewriteRule .* - [F]

—End Source Code—

Blocking all domains and referrers
—Copy Source Code—

RewriteEngine On
# Options +FollowSymlinks
RewriteCond %{HTTP_REFERER} !^http://(www\.)?example\.com/ [NC]
RewriteCond %{HTTP_REFERER} ^http:// [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(www\.)? [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteRule \.* - [F]

—End Source Code—

Blocking specific domains by file formats.
—Copy Source Code—

RewriteEngine On
RewriteCond %{HTTP_REFERER} ^http://(www\.)?badsite\.net/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(www\.)?badsite\.com/ [NC]
RewriteRule \.(jpe?g|gif|png|zip|rar)$ - [F]

—End Source Code—

Blocking a primary domain + subdomains.
—Copy Source Code—

## SITE REFERRER BANNING
RewriteEngine On
# Options +FollowSymlinks

RewriteCond %{HTTP_REFERER} badsite\.com [NC,OR]
RewriteCond %{HTTP_REFERER} sub1\.badsite\.net [NC,OR]
RewriteCond %{HTTP_REFERER} sub2\.badsite\.com [NC]
RewriteRule .* - [F]

—End Source Code—

Denies referrals from specific domain names.
—Copy Source Code—

RewriteEngine On
# Options +FollowSymlinks
RewriteCond %{HTTP_REFERER} ^(http://)?(www\.)?badsite.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^(http://)?(www\.)?badsite.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^(http://)?(www\.)?badsite.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^(http://)?(www\.)?badsite.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^(http://)?(www\.)?badsite.*$ [NC]
RewriteRule .* - [F,L]

—End Source Code—

Denies referrals by file format filtering.
—Copy Source Code—

RewriteEngine On
# Options +FollowSymlinks
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?yourdomain1\.com.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?yourdomain2\.co\.uk.*$ [NC]
RewriteRule \.(jpg|jpeg|png|gif|zip|rar)$ - [F,L]

—End Source Code—

Copyrighted by Lair360

Comments are closed.