Wednesday, 24 June 2015

How To Block Referrer Spam Using Htaccess On Your Site In 2015 ?



Advertisement

Almost 95% of the blogs are affected by spam bots. Spam bots can cause high server load and slow down your site especially if your site is hosted on shared hosting with limited bandwidth and also these bots will increase your site bounce rates creating indirect problem on your site seo.
Even sometimes your site content is scraped on some other sites and also get backlinked by those spam site. So if you get backlinks from spam sites, then you will also receive spam traffic . You can also use google Disavow tool to remove those negative backlinks but to stop bots from entering your sites using those negative or spam backlinks, you shiuld use .htaccess .For Blogger We Dont Have Access to .htaccess File, So we cant block spam bots to blogger sites, also there will be no bandwidth issue is blogger, still there will be an issue of bounce rates.We will soon try to post an article to block or prevent referral spam in blogger/blogspot sites.



What is Referrer Spam ?

Referrer spam (also known as log spam or referrer bombing) is a kind of spamdexing (spamming aimed at search engines). The technique involves making repeated web site requests using a fake referer URL to the site the spammer wishes to advertise.


So, Now Whats Actually Is .htaccess ?

A .htaccess (hypertext access) file is a directory-level configuration file supported by several web servers, that allows for decentralized management of web server configuration.You can define a set of rules in your web server using htaccess. Be carefull with htaccess because small mistake in htaccess file will make your site produce 500 Internal Server Error.

To block spam bots using htaccess, we will use referrer blocking via htaccess.For this we need to find the spam traffic referrers.If you are using wordpress or any other CMS(Content Management Software) , You can Check them in your site stats Or also You can Check Using Google Webmaster Tools > Search Traffic > Links to your Site >  Who links the most . You can also use Awstats to find out Referrers and Ip Address Of Spam Sites Using Your Shared Hosting Cpanel.This htaccess method will also work for wordpress blogs.

You can Make a list of all the spam referrers by once checking the site which links your site . Once the spam links are ready, We Will add them to htaccess to block them.Note that the following requires that ‘mod_rewrite’ is enabled on your server.



RewriteCond %{HTTP_REFERER} spamsite\.com [NC]
RewriteRule .* - [F,L]
The above lines tells the Apache Server to block traffic from the URL ‘sitetoblock.com’. The ‘[NC]’ flag specifies that the referrer site url is not case-sensitive. The ‘F’ flag in [F,L] returns a ‘403 Forbidden’ error, while the ‘L’ flag stops further processing.
Another method is to redirect the traffic to another website, most probably a public website like Google (although I would not recommend this).
RewriteCond %{HTTP_REFERER} spamsite\.com [NC]
RewriteRule .* http://www.google.com [R,L]
Or force it back to the referrer site.
RewriteCond %{HTTP_REFERER} spamsite\.com [NC]
RewriteRule .* %{HTTP_REFERER} [R,L]
To block multiple referrers one can use the [OR] flag.
RewriteCond %{HTTP_REFERER} spamsite1\.com [NC,OR]
RewriteCond %{HTTP_REFERER} spamsite2\.com [NC,OR]
RewriteCond %{HTTP_REFERER} spamsite3\.com [NC,OR]
RewriteCond %{HTTP_REFERER} spamsite4\.com [NC]
RewriteRule .* http://www.google.com [R,L]
Another idea is to return a 301 error.
RewriteCond %{HTTP_REFERER} ^http://www\.spamsite\.com
RewriteRule (.*) http://%{REMOTE_ADDR}/$ [R=301,L]
You can also block traffic from certain ip addresses using the apache ‘Limit’ satement which does not require using ‘mod_rewrite’.You should replace XX.XX.XXX.XXX with spam Ip address.
<Limit GET>
order allow,deny
deny from XX.XX.XXX.XXX
deny from XX.XX.XXX.XXX
allow from all
</Limit>

Still Unable To Find Out Or Block Using htaccess ? Do Post Your Valuable Comments. We Will Try to help you as soon as possible

Loved this Post ? Pls Share It Now - Leave A Comment


Note : All Comments are Manually Approved Before they are published .

Related Posts Plugin for WordPress, Blogger...