If you are getting a ton of useless traffic from a domain (or domains) and you want to block them.. what would you do? If you are using a Linux based server, you can accomplish this using .htaccess.
“Wait.. did you say block traffic.. that sounds crazy right?” Not necessarily.
- There is good traffic (potential customers, people who are interested in reading your content..)
- There is bad traffic (comment spammers, image hot linking, spoofed links on other sites linking to yours..)
To block a certain domain or domains from accessing your website, you can edit your .htaccess file with the following:
<Limit GET HEAD POST>
deny from annoyingdomain1.com
deny from annoyingdomain2.com
allow from all
Just change out the domain (or domains) that you want to block, add the code to your .htaccess file and upload to your server. Those domains should now get a 403 (forbidden) error when attempting to access your website
If you use WordPress (you don’t have to be using WordPress for this to work), the WordPress codex contains a very useful article about combating comment spam and blocking access.
They recommend using:
SetEnvIfNoCase Via evil-spam-proxy spammer=yes
SetEnvIfNoCase Referer evil-spam-domain.com spammer=yes
SetEnvIfNoCase Referer evil-spam-keyword spammer=yes
SetEnvIfNoCase Via pinappleproxy spammer=yes
SetEnvIfNoCase Referer doobu.com spammer=yes
SetEnvIfNoCase Referer poker spammer=yes
allow from all
deny from env=spammer
Hope you found this tip useful!