Feasibility of shielding domestic IP addresses from foreign trade websites

Source: Internet
Author: User
Tags 403 forbidden error

A garment factory is mainly engaged in foreign trade, design clothing for export to Europe and America, all English websites, but most of our website's access IP addresses come from China, chinese counterparts copy your ideas and styles (such as zencart, opencart, magento, and other B2C e-commerce systems), and may also initiate CC and DDoS attacks. How can we disable domestic IP addresses?
You can use either of the following methods to shield IP addresses in China on a foreign trade website (both are strongly recommended ):
1. Use the. htaccess File
In. htaccess, such:
Errordocument 403 http://www.XX.com // This line is optional, meaning that when the IP segment is not allowed to open will jump to this page
Order deny, allow // written in the English Input Method
Allow from 210.249.1.3 // enter your own IP address or IP address segment here to be allowed to access
Allow from 220.240.3.0/24 // enter your own IP address or IP address segment to allow access
Deny from 58.56.0.0/15 // ip address segment for which access is denied
There is also a simple method: blockacountry this website can generate online. htaccess file blocking based on the country you want to shield Code , Generate download and upload to the server.
The disadvantage of shielding IP addresses: If you know that you have used the IP address shielding technology, you can still bypass the shielding by using a foreign proxy server or a foreign VPN to access your website smoothly.
2. Shielding Chinese operating systems (by determining the operating system version of the client)
1. the PHP code is as follows:
$ Client_sys_language = $ _ server ["http_accept_language"]; // System Language
If (preg_match ("/^ ZH-CN/I", $ client_sys_language )){
Echo "Exit;
}
2. 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>

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.