{"id":1285,"date":"2020-02-24T12:50:28","date_gmt":"2020-02-24T12:50:28","guid":{"rendered":"https:\/\/blog.hostinger.io\/support\/2020\/02\/24\/3738302-how-to-enable-geoip-at-hostinger\/"},"modified":"2026-05-08T13:02:48","modified_gmt":"2026-05-08T13:02:48","slug":"3738302-how-to-enable-geoip-at-hostinger","status":"publish","type":"post","link":"https:\/\/www.hostinger.com\/support\/3738302-how-to-enable-geoip-at-hostinger\/","title":{"rendered":"How to Enable GeoIP at Hostinger"},"content":{"rendered":"<p class=\"no-margin\">GeoIP is a method to identify the geographic location of a computer or device through its IP address. GeoIP is <b>supported<\/b> in our Shared, WordPress, Cloud, and cPanel\/WHM hosting plans.<\/p><p class=\"no-margin\">\n<\/p><h2 id=\"h_f9ec65a8f6\">How to Activate GeoIP<\/h2><p class=\"no-margin\">To enable GeoIP, all you have to do is add the following line to your <b><a href=\"\/support\/1583307-how-to-create-an-htaccess-file\" target=\"_blank\" class=\"intercom-content-link\">.htaccess<\/a><\/b> file:<\/p><p class=\"no-margin\">\n<\/p><pre><code>GeoIPEnable On<\/code><\/pre><p class=\"no-margin\">Once added, you can verify if it&rsquo;s working by <b><a href=\"https:\/\/www.hostinger.com\/tutorials\/how-to-create-phpinfo-file\" target=\"_blank\" class=\"intercom-content-link\">creating a PHP Info file<\/a><\/b> and checking the PHP Variables section:<\/p><p class=\"no-margin\">\n<\/p><div class=\"intercom-container intercom-align-center\"><img decoding=\"async\" src=\"\/support\/wp-content\/uploads\/sites\/55\/2020\/02\/dead002f-2c13-4c8e-b142-7e7768711ffc.jpg\" alt=\"PHP phpinfo table with GeoIP server variables highlighted in red\" data-media-id=\"4898\"><\/div><p class=\"no-margin\"><b>NOTE:<\/b><\/p><ul>\n<li>\n<p class=\"no-margin\">We update our GeoIP databases weekly, so you won&rsquo;t need to download them on your own &#128521; <\/p>\n<\/li>\n<\/ul><p class=\"no-margin\">\n<\/p><h2 id=\"h_93189b4ad5\">How to Use It<\/h2><p class=\"no-margin\">You can find different uses for GeoIP, so we will cover one example: if you want to <b>block access<\/b> to your WordPress <b>wp-login.php<\/b> and <b>xmlrpc.php<\/b> files from countries other than Great Britain (UK), United States and India, add the following code to your <b>.htaccess<\/b> file:<\/p><p class=\"no-margin\">\n<\/p><pre><code>RewriteEngine on<br>RewriteCond %{ENV:GEOIP_COUNTRY_CODE} !^(GB|US|IN)$<br>RewriteRule (wp-login|xmlrpc).php$ - [F,L]<br><\/code><\/pre><p class=\"no-margin\">That&rsquo;s it! Now you know how to enable and use GeoIP on your website &#128522; <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Using IP geolocation for your websites at Hostinger<\/p>\n","protected":false},"author":581,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"include_on_kodee":true,"footnotes":""},"categories":[274],"tags":[],"class_list":["post-1285","post","type-post","status-publish","format-standard","hentry","category-website-development"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/support\/3738302-how-to-enable-geoip-at-hostinger\/","default":1},{"locale":"fr-FR","link":"https:\/\/www.hostinger.com\/fr\/support\/3738302-comment-activer-geoip-at-hostinger\/","default":0},{"locale":"id-ID","link":"https:\/\/www.hostinger.com\/id\/support\/3738302-cara-mengaktifkan-geoip-untuk-website-di-hostinger\/","default":0},{"locale":"pt-PT","link":"https:\/\/www.hostinger.com\/br\/support\/3738302-como-habilitar-o-geoip-no-hostinger\/","default":0},{"locale":"uk-UA","link":"https:\/\/www.hostinger.com\/ua\/support\/3738302---geoip--hostinger\/","default":0}],"include_on_kodee":true,"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts\/1285","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/users\/581"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/comments?post=1285"}],"version-history":[{"count":1,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts\/1285\/revisions"}],"predecessor-version":[{"id":4903,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts\/1285\/revisions\/4903"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/media?parent=1285"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/categories?post=1285"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/tags?post=1285"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}