Getting Started

Welcome to the GeoIp Redirect extension documentation.

The GeoIP Redirect extension allows performing specified actions based on:

  • visitor location (country)
  • browser locale (auto-define the user's browser language settings)
  • IP address

There are 4 types of actions are possible:

  • change currency
  • switch store view
  • redirect to an appropriate page
  • restrict access

Go ahead, dive in!

Firstly, please, find our extension in My Downloadable Products section of our store.

Learn how to install extension, and proceed with Quick Start, which will guide you to setup general rules.

How to install the extension

  1. Backup your store's database and web directory.
  2. Login to the SSH console of your server and navigate to the Magento 2 store's root directory.
  3. Copy the installation instructions from the page My Downloadable Products to the SSH console and press ENTER.
  4. Run command php -f bin/magento module:enable Mirasvit_Core Mirasvit_GeoIp to enable the extension.
  5. Run command php -f bin/magento setup:upgrade to install the extension.
  6. Run command php -f bin/magento cache:clean to clean the cache.
  7. Deploy static view files

    rm -rf pub/static/*; rm -rf var/view_preprocessed/*; php -f bin/magento setup:static-content:deploy

If the extension was installed thought direct files uploading, also need run command composer require geoip2/geoip2:~2.0 for install required libraries.

Install the extension for Hyva

  1. Run the command

        composer require mirasvit/module-geo-ip-hyva:*
  2. Enable installed Hyva modules:

        bin/magento module:enable Hyva_MirasvitGeoIp
  3. Update Magento database schema and data with the command:

        bin/magento setup:upgrade
  4. Compile the code of the installed extension:

        bin/magento setup:di:compile
  5. Run the command below to clean the cache:
        bin/magento cache:flush

Quick Start

Our GeoIP extension is a simple yet powerful extension that requires just to add appropriate redirect rules. All general settings are predefined out-of-box.

The first things that you need to configure are:

  • currency change rules
  • store switch rules

This is a good start. Refer to corresponding sections of the manual to know more.

GeoIP Rules

GeoIP Rules define the action that should do the extension if a visitor came from the specified country. Additionally, the extension can separate visitors by their Browser Locale or IP address.

All rules are located at System -> GeoIP Redirect -> GeoIP Rules.

Please, check demo with common rules configuration.

How to create a new Rule

Visit System -> GeoIP Redirect -> GeoIP Rules and press Add New Rule button.

You will be brought to the Rule creation page, which consists of 3 key subsections:

General Information

  • Name - internal name of the rule.
  • Is Active - whether the rule is active.
  • Priority - the sort order for apply rules (if a visitor's location follows 2 or more rules). 100 - the lowest priority. 0 - the highest priority (apply it first).
  • Notes - additional internal information about the rule.

When to apply the rule

  • When visitor - defines what property of visitor rule should validate:
    • Country - visitor country (based on IP). You can choose one or more countries to redirect customers from those countries to each corresponding store view. When one country is allocated to a few of them, customers are redirected to the store view with the lower ID.
    • Browser Locale. Customers will be redirected to the store view automatically based on their browser language settings.
    • IP Address
  • Country is / Locale is / IP is - based on previous option, you should enter appropiate values for one of this fields.

What to do

In this section, you enable actions that should do the extension if a visitor follows the previous condition.

Note

They are two similar actions: Redirect and Restrict access. The difference in the workflow. Redirect option, redirect visitors only once (first open).

Restrict access option permanently redirects the visitor to some page (/504, for example).

How to upgrade extension

To upgrade the extension, follow these steps:

  1. Backup your store's database and web directory.
  2. Login to the SSH console of your server and navigate to the root directory of the Magento 2 store.
  3. Run command composer require mirasvit/module-geo-ip:* --update-with-dependencies to update current extension with all dependencies.

    Note

    In some cases, the command above is not applicable, or it's not possible to update just the current module, or you just need to upgrade all Mirasvit modules in a bundle. In this case, the command above will not affect.

    Run instead composer update mirasvit/* command. It will update all Mirasvit modules installed in your store.

  4. Run command php -f bin/magento module:enable Mirasvit_Core Mirasvit_GeoIp to re-enable extension.
  5. Run command php -f bin/magento setup:upgrade to install the updates.
  6. Run command php -f bin/magento cache:clean to clean the cache.
  7. Deploy static view files

    rm -rf pub/static/*; rm -rf var/view_preprocessed/*; php -f bin/magento setup:static-content:deploy

Disabling the Extension

Temporarily Disable

To temporarily disable the extension please follow these steps:

  1. Login to the SSH console of your server and navigate to the root directory of the Magento 2 store.
  2. Run command php -f bin/magento module:disable Mirasvit_GeoIp to disabled the extension.
  3. Log in to the Magento backend and refresh the store cache (if enabled).

Extension Removal

To uninstall the extension, please follow these steps:

  1. Login to the SSH console of your server and navigate to the root directory of the Magento 2 store.
  2. Run command composer remove mirasvit/module-geo-ip to remove the extension.
  3. Log in to the Magento backend and refresh the store cache (if enabled).

Change Log

1.2.11

(2024-07-30)

Fixed

  • Page styling issue when pressing browser back button after redirect

1.2.10

(2024-05-08)

Improvements

  • Support Mirasvit GDPR extension v1.4

1.2.9

(2024-04-24)

Improvements

  • Ability to choose redirect data storage (Session/Cookies)

1.2.8

(2024-03-19)

Improvements

  • Removed ___store parameter from URL

1.2.7

(2023-04-21)

Improvements

  • Ability to apply debugging to only one ip address

1.2.6

(2023-04-10)

Fixed

  • Compatibility with Hyva theme
  • Issue with displaying popup with redirect notice

1.2.5

(2023-01-31)

Improvements

  • Added support of Magento 2.4.6

Fixed

  • Compatibility with php8.1

1.2.4

(2022-08-19)

Fixed

  • Url on redirect

1.2.3

(2022-08-16)

Improvements

  • Ability to select location of remote ip address

1.2.2

(2022-06-24)

Fixed

  • Issue with premature hiding of messages

1.2.1

(2022-06-20)

Improvements

  • remove db_schema_whitelist.json

1.2.0

(2022-05-23)

Improvements

  • Migrate to declarative schema

1.1.6

(2021-10-12)

Fixed

  • Updated GeoLite2-City database

1.1.5

(2021-10-05)

Features

  • Redirect by url parameter

1.1.4

(2021-09-22)

Fixed

  • Added translation for the redirect popup message

Improvements

  • All the module settings are available for websites

1.1.3

(2021-09-01)

Improvements

  • Cloudflare compatibility

1.1.2

(2021-07-26)

Fixed

  • Issue with redirecting to another site when using multiple websites

1.1.1

(2021-03-26)

Fixed

  • Fixed issue with detecting locales
  • Issue when in the backend Rules grid the name of the selected Rule displayed incorrectly when deleting it from Actions

1.1.0

(2020-12-15)

Improvements

  • Redirect rules can be applicable for particular stores (#24]()

1.0.9

(2020-11-25)

Fixed

  • Fixed issue with detecting locales of some browsers [#22]()

1.0.8

(2020-11-13)

Improvements

  • GeoLite database update ([#20]())

1.0.7

(2020-11-04)

Fixed

  • Fixed issue with redirect to store ([#18]())

1.0.6

(2020-10-30)

Fixed

  • Fixed store redirect issue ([#16]())

1.0.5

(2020-09-11)

Improvements

  • Small spelling fixes

1.0.4

(2020-08-10)

Features

  • Support of varnish cache

1.0.3

(2020-07-30)

Improvements

  • Support of Magento 2.4

1.0.2

(2020-06-09)

Fixed

  • Perform actions only for GET requests

1.0.1

(2020-02-27)

Fixed

  • Minor fixes

1.0.0

(2020-01-22)

Improvements

  • Initial release