Articles on: Security Info

How to Block Visitors from Specific Countries Using .htaccess

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

To generate the block list, select IPv4, select the country (if you require more than 1, you’ll need to sign up for a free account that allows up to 30 countries) and choose Apache 2.0-2.3 .htaccess deny from the drop down menu and click DOWNLOAD



You will get to download a text file which is to be uploaded to your homepage’s directory as .htaccess. Copy and paste in the file .htaccess in your hosting



Refer this link to edit .htaccess file :
https://help.serverfreak.com/en/article/how-to-edit-htaccess-file-via-the-cpanel-1k7kqr0/

Updated on: 07/01/2023

Was this article helpful?

Share your feedback

Cancel

Thank you!