How to Block Countries Using the .htaccess File

This guide will show you how you can ban certain IPs or countries from accessing your website. This comes in handy if you are having resource issues with your hosting providers. The first thing you want to check is where your hits are coming from. I usually go in AWSTATS and check the Countries hitting my websites and also which IPs are using a lot of bandwidth. The image below shows one of my website, this one doesn’t have a issue with resources but I’m just using it as an example.

This is a fairly new website and not getting much hits but if you see a lot of bandwidth being used up by China, Russia or any other country that does not relate to your niche and locale then you can try banning known spamming IPs and see if that helps with your resource usage.

The website I will be using for this guide to generate a list of IPs to ban is 

I’m sure there are tons of different websites that do the same thing. So please feel free to google around and find other websites. If you visit the website I added above you should see the below. You can check off the Countries you want to ban and then click to Generate the code to paste in your .htaccess file.

Once you have generated the list, you will need to right click and select all and copy. You will be pasting this text into your Fresh Store Builder .htaccess file.

Find the .htaccess file for your store. IF you are using FTP software then its the same steps. Find the .htaccess file on your directory where your FSB files are uploaded and click to edit the file.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.