Block a Country from Your Site Using .htaccess

Block a Country From Your Site Using .htaccess

A country maybe blocked from accessing a website due to various reasons which are known to the website owner. Perhaps due to many hacking problems, the irrelevance of your content to them or even need to advertise a post only to local people temporarily. This is usually by blocking their IP address using and IP blocker tool and denying their access.

 

How To Block Using .htaccess

  • Open .htaccess through public-html in file manager
  • Use IP2 Locations Free visitor blocker generator to create an IP deny list. (Order
    Deny,Allow
         Deny from 31.1.1.1
 Deny from 32.2.29/42
 Deny from 33.3.30/42
 Allow all)
  • Right click on .htaccess and click on edit
  • Open the file and copy the information in text editor of the htaccess file
  • The IP addresses are usually long and therefore when every browser from that country opens it he will have to download the file, only see the list.
  • Click Save so that any IP from such areas will never access your website.

 

Was this article helpful?

Related Articles

Leave A Comment?