One of my clients asked me to BAN an specific country to one of his sites.
Since we have Cloudflare, this is how I made it…
On .htaccess I’v simply added the following lines – on the top of .htaccess -.
SetEnvIf CF-IPCountry IN BuzzOff=1
SetEnvIf CF-IPCountry PT BuzzOff=1
Allow from all
Deny from env=BuzzOff
Domain/subdomain must have Cloudflare active on DNS settings…
A client needs to get a certain country blocked with .htaccess – or redirected -.
I’m gonna let some links of the solutions here…
Blocking an entire country stops most traffic coming from their IP ranges.
This method isn’t 100% because some countries have slightly overlapping IP ranges.
- Linux IPtable