How to block visitors by country using .htaccess

In some cases we might need to restrict the access to the website from some countries. This can be achieved by configuring the .htaccess file of the website.

Step1: Download the ipaddress list belongs to the countries that we need to restrict, from the below given website.

https://www.ip2location.com/free/visitor-blocker

Please note to download it in .htaccess format.

Step2: Update the downloaded rules to the .htaccess file of our website.

That's all….

Leave a Reply

Your email address will not be published. Required fields are marked *