How to Block Spam or Unwanted Traffic seen in Google Analytics using .htaccess File

You will be observe that there is sudden traffic rise in referral traffic for which you will be happy but after keenly observing the websites that is driving traffic in Google Analytics are all spamming websites. So, if you are looking out solution to ensure that all the websites are getting blocked and are not registered in Google Analytics then .htaccess file is the best source to do the same.

.htaccess spam blocking

Image: linkedin.com
There are few of the spamming websites that include thenextweb.com, motherboard.vice.com and many more, so if you want to block then follow the syntax shown below:
htaccess-url-blocking                                                   Image: webanddesigners.com

## SITE REFERRER BANNING
RewriteEngine on
# Options +FollowSymlinks
RewriteCond %{HTTP_REFERER} xn--lifehacer-1rb\.com [NC]
RewriteCond %{HTTP_REFERER} motherboard.vice\.com [NC]
RewriteCond %{HTTP_REFERER} brateg\.xyz [NC]
RewriteCond %{HTTP_REFERER} abc\.xyz [NC]
RewriteCond %{HTTP_REFERER} boltalko\.xyz [NC]
RewriteCond %{HTTP_REFERER} addons.mozilla\.org [NC]
RewriteCond %{HTTP_REFERER} brateg\.xyz [NC]
RewriteCond %{HTTP_REFERER} boltalko\.xyz [NC]
RewriteCond %{HTTP_REFERER} biteg\.xyz [NC]
RewriteCond %{HTTP_REFERER} bukleteg\.xyz [NC]
RewriteCond %{HTTP_REFERER} arendovalka\.xyz [NC]
RewriteCond %{HTTP_REFERER} buketeg\.xyz [NC]
RewriteCond %{HTTP_REFERER} bezlimitko\.xyz [NC]
RewriteCond %{HTTP_REFERER} begalka\.xyz [NC]
RewriteCond %{HTTP_REFERER} abcdefh\.xyz [NC]
RewriteCond %{HTTP_REFERER} advokateg\.xyz [NC]
RewriteRule .* – [F]

spamming websites
If you want to block ip address in .htaccess file then use the below syntax of the example shown :

order allow,deny
deny from 10.1.1.1
deny from 172.16.10.20
deny from 10.5.50.1
deny from 100.10.10.1
deny from 172.16.252.2
deny from 192.168.1.1
deny from 10.208.112.1
deny from 172.16.2.33
deny from 192.168.140
deny from 10.205.122.71
deny from 10.254.40.114
deny from 10.30.0.152
deny from 10.60.60.1
deny from 10.10.0.1
deny from 10.10.10.254
deny from 10.10.220.252
deny from 10.10.220.253
deny from 1.1.1.1
deny from 10.0.16.49
deny from 10.1.100.2
deny from 10.10.10.1
deny from 10.10.20.1
deny from 10.100.100.1
deny from 10.192.97.147
deny from 10.205.3.55
deny from 10.60.34.152
deny from 111.221.29.49
deny from 172.16.0.1
deny from 172.16.16.1
deny from 172.17.69.1
deny from 172.20.2.15
deny from 180.149.33.179
deny from 192.168.11.1
deny from 192.168.110.1
deny from 192.168.25.250
deny from 192.168.254.1
deny from 192.168.5.32
allow from all

 

No Comments Yet

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>