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
3
1.1.1.1
Deny from
3
2.2.
29/42
Deny from
3
3.3.3
0/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.