I have daily received robot traffic to my website with the intention that I lose my Google AdSense account . I have been able to handle the situation very well and I have blocked all the countries that the robot traffic comes from using this code in my .htaccess file
# Lista de países bloqueados
GeoIPEnable On
SetEnvIf GEOIP_COUNTRY_CODE RS DenyCountry
SetEnvIf GEOIP_COUNTRY_CODE US DenyCountry
SetEnvIf GEOIP_COUNTRY_CODE MX DenyCountry
SetEnvIf GEOIP_COUNTRY_CODE AU DenyCountry
SetEnvIf GEOIP_COUNTRY_CODE NL DenyCountry
Allow from all
Deny from env=DenyCountry
What really strikes me is whether the cities of the countries can be blocked using this same code, only by changing the iso code .
Other solutions
Currently I can block a city using PHP code, getting the location of the visitor and creating a condition to remove it from the page or send it to a specific place, and that would be fine too, but I think it would be much more interesting if I could control with htaccess
Please if anyone knows anything about this topic, let me know.