Need to block users from a certain country from visiting your website using .htaccess but still want to keep using Cloudflare optimization services?
Just add this piece of code to your .htaccess
SetEnvIf CF-IPCountry IN BuzzOff=1 Order allow,deny Allow from all Deny from env=BuzzOff
In the above code, we are blocking all users from India(IN), replace IN with the country code of one you want to block.
Hello!
I did so for 3 minutes ago.
It does not work. There is time for him to get started?
Hello, the code works I have had it tested multiple times, but for it to work you must have the site traffic pass through cloudflare, did you maybe turn off that?