GeoIP is a method to identify the geographic location of a computer or device through its IP address. GeoIP is supported in our Shared, WordPress, Cloud, and cPanel/WHM hosting plans.
How to Activate GeoIP
To enable GeoIP, all you have to do is add the following line to your .htaccess file:
GeoIPEnable On
Once added, you can verify if it's working by creating a PHP Info file and checking the PHP Variables section:
NOTE:
We update our GeoIP databases weekly, so you won't need to download them on your own 😉
How to Use It
You can find different uses for GeoIP, so we will cover one example: if you want to block access to your WordPress wp-login.php and xmlrpc.php files from countries other than Great Britain (UK), United States and India, add the following code to your .htaccess file:
RewriteEngine on
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} !^(GB|US|IN)$
RewriteRule (wp-login|xmlrpc).php$ - [F,L]
That's it! Now you know how to enable and use GeoIP on your website 😊