The 24/7 Learning Academy
The 24/7 Learning Academy is a place where professional are ready to inspire young minds and help them with their studies .we help, assist and guide young , teenagers and students .
The 24/7 Learning Academy
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Top posters
HAMADA (1072)
1072 Posts - 71%
BRIM (160)
160 Posts - 11%
boualem02 (97)
97 Posts - 6%
tanita (43)
43 Posts - 3%
sasuna (41)
41 Posts - 3%
razane (26)
26 Posts - 2%
23 Posts - 2%
tanita- (16)
16 Posts - 1%
12 Posts - 1%
mayssa (11)
11 Posts - 1%
Search
Display results as :
Advanced Search

Go down
HAMADA
HAMADA
Administrator
Administrator
Number of posts : 1072
Age : 63
Location : BOUKADER CHLEF
Registration date : 2007-12-17
https://the247la.goodforum.net

How to block a whole country from visiting your website Empty How to block a whole country from visiting your website

Sun Jul 10, 2011 9:30 pm
How to block a whole country from visiting your website

There are times when you may want to ban visitors from a certain country from viewing your website, the reasons for this can be many.

You can block people from viewing your website using rules in your firewall IP tables but if you dont have access to that, you can edit the .htaccess file and add a list of IPs to be blocked, you can get the whole IP range from a country from countryipblocks.

Select one or more country you want to block on home page of www.countryipblocks.net and press Choose Countries

How to block a whole country from visiting your website Ishot-115

Now on next screen you can see set of command, copy it and paste it to your .htaccess file, in case if you don’t have it in ftp then kindly talk to your host or create one using notepad or another text editor. This code having set of IP from countries you selected and it simply reject visitors request from those countries.

How to block a whole country from visiting your website Ishot-114

Upload that .htaccess file into root of your domain using a ftp client. Every time when a visitor request your site from server it look into .htaccess file and if IP address of that visitor fall with in range of all denied IPs of your .htaccess then it will simply deny visitor request.

However this solution may cause server overload if many requests are made from that country, another easier way to do this, is by banning people from accessing your website according to their browser language set up, for example to ban people who is using a Chinese internet browser you will add to your .htaccess file:

RewriteCond %{HTTP_ACCEPT_LANGUAGE} zh-CN
RewriteRule .* – [F]


THis will generate error 403 message, and the visitor will get a “Forbidden” message when visiting your page, but it can be changed to something else. The zh-CN is the browser setting for Chinese, this can be changed to any other language you like.
Back to top
Permissions in this forum:
You cannot reply to topics in this forum