For more details see the GeoIP Redirect extension page.
Detect store visitor's location and automatically provide them with the appropriate store view, currency, and language. Move your business to the global level without creating additional stores.
To install the GeoIP Redirect database, go to Stores → Configuration → Amasty Extensions → GeoIP Data.
You can get the databases automatically or import your own data.
Hit the Download and Import button to make the extension download the updated sql dump file and import it into your database automatically.
To import the files from your own source, use the Import option. Path to the files should look like this (the part 'var/amasty' should be replaced with your folders’ names):
If you face any difficulties with importing the location database, please see the following solution.
To configure the GeoIP Redirect extension, go to Stores → Configuration → Amasty Extensions → GeoIP Redirect.
Apply Logic To — select the general logic of redirecting rules:
Excepted URLs — choose the Specified URLs or All Except Specified URLs options above to define the excepted URLs here.
User Agents to Ignore — ignore redirection rules for specified search engines.
Restriction by IP — restrict redirection for certain IP addresses.
First Visit Redirect Only — activate to enable redirection only for the first visit.
Redirect Between Websites — enable to redirect visitors between several websites.
Enable Country –> Store View — enable to redirect visitors from certain countries to particular store views.
When enabled, switch the Store View dropdown menu to the required version and define the list of countries that will be affected.
Enable Country –> Currency — set this option to Yes to automatically switch currency according to user’s location.
Country to Currency Mapping — define country — currency relation by selecting countries and the appropriate currencies. Hit the Add button to create a new relation.
Enable Country –> URL — enable to redirect visitors from certain locations to any other URL.
Country to URL Mapping — select locations and specify the URL that would be used for redirection. Use the Add button to create a new country — URL relation.
Sometimes, it is unable to complete the database import due to execution time limit of PHP scripts. You can avoid this error by increasing the maximum execution time for your PHP scripts.
You need to set the max_execution_time to the number of seconds that all your scripts are allowed to run in your PHP's configuration file. The file location may differ from system to system but in general you need to find the PHP.INI file and modify it.
We need to set the value to 18000.
; Maximum execution time of each script, in seconds ; http://php.net/max-execution-time ; Note: This directive is hardcoded to 0 for the CLI SAPI max_execution_time = 18000
Setting the value to 0 means there's no time limit.
You'll have to restart your web server for this solution to work.
Find out how to install the GeoIP Redirect extension via Composer.