Robot Portal

Easily manage all aspects of your account | Knowledgebase |

Usage: mod_geoip

We have seen loads of our clients use .htaccess to block different type of country (Using Ip ranges). There are several reasons for doing it. Most of the cases, Webmasters block country traffic for abusing Bandwidth, Protecting Google Adsense Smart Pricing etc. Although, .htaccess blocking works, but it creates extra loads on the server. As we are not intended to block or suspend anyone's account for such thing, thats why we have implemented mod_geoip on the server and suggest our clients to block traffic (If required) using mod_geoip instead of IP range blocking using .htaccess

mod_geoip needs to be implemented using .htaccess, it is also configurable using PHP. Here we will describe some examples to block countrywise traffic using mod_geoip and .htaccess (Without IP range)

To block traffic other than US, UK and Canada use the following code:

RewriteEngine On
RewriteRule ^(.*)$ block.php [NC,L]

This code is negating for the traffic of US, GB and CA and redirecting them to block.php, you can change it to different site like, to redirect traffic to just replace block.php to

To block certain traffic you can use a code for example:

RewriteEngine On
RewriteRule ^(.*)$ block.php [NC,L]

This code will block the traffic from China and Iran, then redirect them to block.php. block.php is also replacable with a website address. But it must be included with "http://"

Country code is Important here, as country code needs to be used to block the traffic from countries. You can find the country code located

  • 50 Users Found This Useful

Was this answer helpful?

Related Articles

Binary Location of FFMPEG!

[Applicable for all of our servers]If you are trying to use FFMPEG, then you would be looking for...

Binary Location of Required Modules to play embedded Video!

[Applicable for the server name All HostSEO's Servers] Mplayer /usr/local/bin/mplayer...

ImageMagick Location

Imagemagick binary/convert is located under /usr/binConvert file: /usr/bin/convert

PHPShield Error

Please take a look at the following url: If you...

Born in 2004 ... Trusted By Clients n' Experts

SEO Stars

They never made me feel silly for asking questions. Help me understand how to attract more people and improve my search engine ranking.

Read More

Emily Schneller Manager at Sabre Inc
SEO Stars

Took advantage of Hostseo's superb tech support and I must say, it is a very perfect one. It is very fast, servers reliability is incredible.

Read More

Leena Mäkinen Creative producer
SEO Stars

We're operating a worldwide network of servers with high quality standards requirements, we’ve choose hostseo to be our perfect partner.

Read More

Ziff Davis CEO at Mashable
SEO Stars

It’s very comfortable to know I can rely about all technical issues on Hostseo and mostly that my website and emails are safe and secured here.

Read More

Isaac H. Entrepreneur
SEO Stars

With hostseo as a hosting partner we are more flexible and save money due to the better packages with great pricing, free SEO n' free SSL too!

Read More

Madeline E. Internet Professional