GeoIP refers to the method of locating a computer terminal's geographic location by identifying that terminal's IP address. GeoIP is supported in both hPanel hosting and cPanel/WHM hosting.

In order to activate GeoIP all you have to do is enter the following line in your .htaccess file:

GeoIPEnable On

After adding, you can verify if it's working by checking your PHP Info file, you can create it using following tutorial: https://www.hostinger.com/tutorials/how-to-create-phpinfo-file

Following server variables should appear in PHP info file:

$_SERVER['GEOIP_ADDR']
$_SERVER['GEOIP_CONTINENT_CODE']
$_SERVER['GEOIP_COUNTRY_CODE']
$_SERVER['GEOIP_COUNTRY_NAME']
$_SERVER['GEOIP_CITY']
$_SERVER['GEOIP_POSTAL_CODE']
$_SERVER['GEOIP_CITY_CONTINENT_CODE']
$_SERVER['GEOIP_CITY_COUNTRY_CODE']
$_SERVER['GEOIP_CITY_COUNTRY_NAME']
$_SERVER['GEOIP_REGION']
$_SERVER['GEOIP_DMA_CODE']
$_SERVER['GEOIP_LATITUDE']
$_SERVER['GEOIP_LONGITUDE']
$_SERVER['GEOIP_ISP']
$_SERVER['GEOIP_ORGANIZATION']

Note: You don't need to download GeoIP databases as we handle this for you, we update our GeoIP databases weekly.

Example: Block wp-login.php from certain countries

For example, to block WordPress wp-login.php or xmlrpc.php access from countries not in (GB|DK|US|IN):

GeoIPEnable On
RewriteEngine on
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} !^(GB|DK|US|IN)$
RewriteRule (wp-login|xmlrpc).php$ - [F,L]

Did this answer your question?