Blocking visitors by country using htaccess (Firewall) can be useful in case your blog/website is experiencing high volume of attack from particular country. It can also be very useful in case your website is experiencing DDOS attack from particular country.
For the example, we have tried to block China to browse website.
Access your htaccess file from you Cpanel. Add the below code to your htaccess files and save it.
<Limit GET HEAD POST> order allow,deny allow from all deny from 18.104.22.168/24 deny from 22.214.171.124/23 deny from 126.96.36.199/22 </Limit>
To block all the visitor from particular country you need to find IP range of that country which you can get from ip2location website.