I am having some trouble with referrer spam on several sites, and I am trying to block the IP of those sites. I used domaintools to check the IP address and use that to block incoming traffic. However, according to Google Analytics, they are still getting through. What am I doing wrong? How can I stop referrer spam?
nginx - in the /etc/nginx/sites-available/example.com
file
server {
...
location / {
deny 12.345.67.890;
}
...
}
Apache - in the .htaccess
file at the root directory
Order Deny,Allow
Deny from 12.345.67.890
the
deny
directive, just block the request if the origin ip match.So if your problem is with the referrers, check the $http_referer.
In NGINX you can do something like:
In APACHE:
It should do the trick.