How to block domestic IP access to our website in some way!

Source: Internet
Author: User
Tags 403 forbidden error

As enterprises independently operate their own foreign trade website, the rise of foreign trade website, more and more heard a voice: how to block Chinese IP address? Operating foreign trade business-to-business, foreign Trade website company, all want to browse the site is a foreign customer, for price competition, picture piracy and other issues, do not want competitors to see their website. So now a lot of Web sites began to use some technical means to block domestic access, shielding China's IP address. So what is the role of shielding domestic IP access? There are five main aspects of the consideration: first, to prevent domestic counterparts to browse, protect the originality of the product is not copied, to avoid unnecessary competition; second, avoid the characteristics of the site by the domestic counterparts copied, pro-engine; third, special needs, such as regional sites, regional sites, save resources and traffic; To avoid their own website by some domestic spammers included; V. To make inquiries and inquiries more accurate, to avoid the domestic counterparts to explore the price. Understand the role of foreign trade website shielding domestic IP access, here to teach you to set the method of shielding domestic IP access and how to access the site has been set to block the domestic IP.
Foreign trade website shielding the domestic IP address can be used in the following two ways (strongly recommend the combination of both):
I. Using the. htaccess file
In. htaccess, such as:
ErrorDocument 403 http://www.xswu.org//This line is optional, meaning that you will jump to this page when the IP segment is not allowed to open.
Order Deny,allow//writing done in English input method
Allow from 210.249.1.3//Enter your own IP or IP segment here, be allowed to access
Allow from 220.240.3.0/24//Enter your own IP or IP segment here, be allowed to access
Deny from 58.56.0.0/15//denied access IP segment
There is an easy way: Blockacountry This site can be based on the country you want to block, online generation of. htaccess file screen code, generate download upload to the server.
The disadvantage of shielding IP: If users know that you use IP shielding technology, through the use of foreign proxy server or a foreign VPN, you can still cross the shield, unimpeded access to your website.
Second, shielding the Chinese operating system (by judging the client's operating system version)
1. Block the Chinese operating system PHP code as follows:
$client _sys_language = $_server["Http_accept_language"]; System language
if (Preg_match ("/^zh-cn/i", $client _sys_language)) {
echo "Exit
}


2. Start with the browser and disable the Chinese browser.

JavaScript code:
<script type= "Text/javascript" >
if (navigator.language)
var language = Navigator.language;
Else
var language = Navigator.browserlanguage;
if (Language.indexof (' zh ') >-1) document.location.href = ' nddbc.html ';
</script>

How to block domestic IP access to our website in some way!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.