Access to the mod_geoip module is included with all accounts. mod_geoip allows you to redirect traffic from certain countries which you specify. This is good if you have different versions of your site for people in different countries. There are also of course many other reasons you may have to redirect traffic from specific countries. 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.
Step 4: To add a country to the redirect list, first find the two-digit code for the country you want to block using this list of country codes.
Step 5: Traffic can be redirected from one or multiple countries.
To redirect traffic from only one country, put this at the top of your .htaccess file: RewriteEngine On RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^XX$ RewriteRule ^(.*)$ http://www.example.com/somepage.html$1 [L]
Just replace XX with the country code you wish to block. Replace http://www.example.com/somepage.html with the URL you want the traffic redirected to.
Example of redirecting Canadian traffic to http://canada.example.com:
RewriteEngine On RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^CA$ RewriteRule ^(.*)$ http://canada.example.com$1 [L]
To redirect traffic from multiple countries, use this instead:
RewriteEngine On RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^(XX|XX|XX|XX|XX|XX)$ RewriteRule ^(.*)$ http://www.example.com/somepage.html [L]
Just place each country codes you wish to block in place of each XX. You can have as few or as many country codes as you want. Replace http://www.example.com/somepage.html with the URL you want the traffic redirected to.
Example of redirecting traffic from China, Taiwan, Hong Kong, Saudi Arabia, Iran and Nigeria to http://test.example.com/info.html
RewriteEngine On RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^(CN|TW|HK|SA|IR|NG)$ RewriteRule ^(.*)$ http://test.example.com/info.html [L]
NOTE: You can not redirect traffic to a page on the same domain. You MUST redirect traffic OUTSIDE of your domain. For instance, if your domain is example.com DO NOT redirect the traffic to example.com/stuff.html or any other page on example.com. Redirect it to a subdomain like stuff.example.com or to another domain altogether.
NOTE: You can test your redirect by adding your own country and then removing it after you have tested.
If you are having trouble setting up a redirect or if you receive an error, please contact support.
|
|
|
|
What ports should I use?
The default port 110 is set up to handle incoming e-mail. Almost all e-mail programs set this automatically so there is no need to set this yourself. The default...
|
| Created |
2008-10-04 |
Views |
3 |
| Modified |
2008-10-04 |
Id |
64 |
| Author |
|
|
|
|