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.

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:

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). 0 - the lowest priority. 100 - 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.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