Out of the box Magento doesn't provide any possibility to allow/block the website for specific IPs or countries. It is supposed to be done by means of htaccess. To set it up correcly please check our special guide.
Magento 2 Geo Lock extension makes it possible to identify your shoppers' location and allow/deny them access to the store.
Manually specify countries to allow/deny accessing your site content.
Geo Lock supports both Community and Enterprise edition of Magento 2 starting from version 2.1. The current version of the Magento installed on your website can be found in the lower right corner of any backend page.
Geo Lock has 2 separate ways of installation: via Composer or by copying the code.
To observe the extensions settings, go to STORES ⟶ Configuration ⟶ MAGEWORX ⟶ GeoIP Extensions.
All the extension configurations are provided under the Geo Lock tab.
They can be logically divided into 3 parts.
If the clients observe some problems after the installation of the extension. they can easily disable its functionality by selecting No in the Enabled configuration setting.
Here the store owner can either Allow access to some peculiar countries or Deny it for some regions. To select several countries one by one, hold the Ctrl key and click the items one by one. To select a group, hold the Shift key and select the first and the last option.
Both White List and the Black List can be filled here. The wildcard symbol * can be used for IP arrays.
If both whitelist and blacklist are populated, then only the whitelist will be used (only the mentioned IPs will be allowed to view the website, the Geo Lock by countries wouldn't be taken into consideration).
If the same IP is in the white list and the black list, then it will be allowed as the whitelist has higher priority.
If the store owner IP is specified in the blaclist, or is not provided in the whitelist, or is blocked in the countries settings, the frontend will be locked.
Nevertheless, the admin page will still be accessible so it can be removed without any problems.