Access to the mod_geoip module is included with all accounts. mod_geoip allows you to block certain countries from accessing your site. To do this, follow these instructions:
Step 1: FTP in to your site and go to your public_html directory.
Step 2: Download the file called .htaccess.
Step 3: Open .htaccess in a text editor and locate this section, which should be at or near the top:
SetEnvIf GEOIP_COUNTRY_CODE CN BlockCountry SetEnvIf GEOIP_COUNTRY_CODE TW BlockCountry SetEnvIf GEOIP_COUNTRY_CODE HK BlockCountry SetEnvIf GEOIP_COUNTRY_CODE SA BlockCountry SetEnvIf GEOIP_COUNTRY_CODE IR BlockCountry SetEnvIf GEOIP_COUNTRY_CODE NG BlockCountry Deny from env=BlockCountry
Each line that starts with SetEnvIf blocks a different country. You will notice near the end of each line is a two-digit country code. For example, the country code CN belongs to China. Notice that the first line blocks this country.
Step 4: To add a country to the block list, first find the two-digit code for the country you want to block using this list of country codes.
Step 5: Now that you know the code for the country you wish to block, add the following line ABOVE the Deny from env=BlockCountry line:
SetEnvIf GEOIP_COUNTRY_CODE XX BlockCountry
Just replace XX with the two-digit country code you selected from the list.
For example, let's say you selected Egypt. This is what your new code might look like. Notice EG added at the bottom for Egypt:
SetEnvIf GEOIP_COUNTRY_CODE CN BlockCountry SetEnvIf GEOIP_COUNTRY_CODE TW BlockCountry SetEnvIf GEOIP_COUNTRY_CODE HK BlockCountry SetEnvIf GEOIP_COUNTRY_CODE SA BlockCountry SetEnvIf GEOIP_COUNTRY_CODE IR BlockCountry SetEnvIf GEOIP_COUNTRY_CODE NG BlockCountry SetEnvIf GEOIP_COUNTRY_CODE EG BlockCountry Deny from env=BlockCountry
NOTE: You can test your block rule by adding your own country and then removing it after you have tested.
If you are having trouble setting up a block rule or if you receive an error, please contact support.
|
|
|
|
How do I block individual IP addresses?
It is possible to block an individual IP address from accessing your web site. To do this, follow these instructions: Step 1: Log in to your cPanel. Step 2: Once you...
|
| Created |
2008-10-04 |
Views |
4 |
| Modified |
2008-10-04 |
Id |
63 |
| Author |
|
|
|
|