If you own a website or a blog, you know the amazing feeling when you get decent traffic. This blog title might get you to ask a query which is why in the world will someone want to block a whole nation from their website. Well you’ll be astonished to know that there are many out there who are actually blocking specific countries from their websites. Some users are targeting their website to precise countries and don’t want visitors from other countries for better management of their server resources while others just don’t want to deal with certain countries for their known spammers or hackers crowd.[E.g. China accounts for nearly 41% of the total cyber-attacks that were made around the world]
If you’re looking to block an entire country from your website then you’re in good fortune. We’re going to segment the steps on how you can block nations from visiting your website using your .htaccess file.
How to block a country from your website using the .htaccess file
1] First you need to find the list of IPs for the country that you want to block. To search this, visit http://www.ip2location.com/free/visitor-blocker. Choose the nation that you want to block and then select the output format as Apache .htaccess deny and then download the file.
2] Now log into your cPanel
3] Click on File Manager and then select the Web Root radio control. You have to confirm that SHOW HIDDEN FILES is tested. Then click on GO to access the files.
4] Here you want to look for .htaccess file. When you’ve found it, right click on the file and click on Edit.
5] After you’re in the .htaccess editor, basically copy the code from the file that you downloaded in Step 1 and paste the code now. Click on Save to safeguard the code is protected in the file. [Note: Choosing popular countries can consequence into thousand lines in block code]
That’s it, now any visitor from the IP range that you’ve added in the .htaccess file will not be able to access your webpages. We recommend that you take additional provision while trying these footsteps.
If you have any kind of queries? You can simply drop a comment underneath and we’ll respond to your questions.