IP Geolocation Redirect for Magento 2
Show each visitor the store view and currency that fit their country, browser language or IP address.
Redirect to any page, ask before switching, or restrict access by country, while search bots and cached pages keep working as usual.
- Switch the store view by country, browser language or IP
- Show prices in the visitor's currency
- Keep visitors on the same page in their store view
- Redirect to any URL or restrict access
- Ask with a confirmation popup before switching
- Work with Varnish out of the box, no VCL changes
- Skip search bots and excluded pages
Show Every Visitor Their Own Store
A shopper from Germany lands on your US store, sees prices in dollars and wonders whether you ship to Berlin at all. Many leave instead of looking for the language switcher.
IP Geolocation Redirect detects the visitor's country from their IP address, along with their browser language, and applies your rules: switch to the right store view, show prices in the local currency, send the visitor to a specific page, or restrict access. Search engine bots are not redirected, so every store view stays crawlable. It works with Varnish and full page cache out of the box, on Magento Open Source and Adobe Commerce.
-
Store switcher by country: Visitors from France get your French store view, visitors from Canada with a French browser can get it too, and everyone else stays where they are.
-
Currency switcher by country: Prices show in the visitor's currency as soon as the rule matches, with or without a store view change.
-
They stay on the page they opened: A visitor who arrives on a product page lands on the same product in their store view, not on its home page.
-
No VCL changes for cached pages: The location check runs after the cached page loads, so redirects keep working behind Varnish.
How the Redirect Rules Work
A condition, an action, a priority
Each rule matches visitors by one condition:
- country
- browser language
- country and browser language together, for example Canada with a French browser
- IP address
- a URL parameter, for campaign links and testing
When a rule matches, it can do one or more of these:
- switch to a store view, and with it the store language
- switch the currency
- redirect to any URL, including a separate site for that region
- restrict access by sending the visitor to a page you choose
A rule can apply to all store views or only to the ones you select. When several rules match, they are applied in priority order, so a specific IP rule can override a broader country rule. The rule setup guide walks through common scenarios.
Works with Varnish and Full Page Cache
Cached pages, live redirects
A cached page is the same for every visitor, so a redirect decided on the server can't reach visitors who get the page from Varnish. IP Geolocation Redirect solves this with Ajax mode, which is on by default: the page is served from cache as usual, then the module checks the visitor's location and switches the store view or currency, or redirects. You don't need to edit your VCL.
You choose whether rules run only on the first visit or on every visit. The visitor's choice is remembered in the session or in a cookie, for as long as you set.
Key Features of IP Geolocation Redirect
Keep visitors on the same page
With Redirect destination set to Same Page, the module finds the equivalent page in the target store view, so a product stays a product. If there is no match, the visitor goes to that store's home page.
Ask before switching
Switch silently, show a notification, or show a confirmation popup where the visitor accepts or stays. You write the popup text; the interface is translated into 15 languages, and screen readers announce the popup buttons.
Restrict access by country or IP
Send visitors from a country or IP address to a page of your choice instead of the store, for example a notice that you don't sell in their region.
Search bots are not redirected
Googlebot and Bingbot are skipped by default, and you can add any other user agent. You can also exclude IP addresses, such as your office, from all rules.
Exclude pages
List the pages where the module should do nothing, one pattern per line with * as a wildcard, for example a launch page you share with invited customers. Add a store code to a pattern to exclude the page in one store view only.
Test rules from another country
Debug mode lets you substitute an IP address from any country for your own requests only, so you can check each rule while real visitors are not affected.
The real visitor IP behind a CDN
Behind Cloudflare or another proxy, every request can seem to come from the proxy. Choose which header carries the visitor's IP, such as CF-Connecting-IP or X-Forwarded-For; the settings show the IP each header currently returns.
Two ways to detect the country
Use the GeoLite2 database, which the module downloads and updates weekly with a free MaxMind account, or the ip-api.com service without a key. Failed lookups are written to a log, and visitors keep browsing normally.
This product includes GeoLite2 data created by MaxMind.
If the extension can support path exception, it will be perfect.
Save time by starting your support request online and we'll connect you to an expert.
What is IP geolocation redirect and why would a store use it?
It shows each visitor the version of your store that fits their location: the right store view, language and currency, detected from their IP address and browser language. Visitors don't have to find the language or currency switcher themselves.
It doesn't hurt SEO when it's set up the usual way: Googlebot and Bingbot are not redirected by default, so search engines can still crawl every store view.
How does IP Geolocation Redirect decide where to send a visitor?
You create rules. Each rule matches visitors by country, browser language, country and browser language together, IP address, or a URL parameter, and then switches the store view, switches the currency, redirects to a URL, or restricts access. You can try the rules in the backend demo.
A rule can switch the store view and the currency at the same time. If you enable the confirmation popup, the visitor accepts the switch or stays on the current store.
Conditions match the values you list. There is no "is not" condition, so to cover all countries except one, add the countries you need to the rule.
Where can visitors be redirected?
A rule can switch to any store view of your Magento installation, including store views on other domains, or redirect to any URL, such as a separate site for that region.
With Redirect destination set to Same Page, the visitor lands on the equivalent page in the target store view, with the home page as a fallback. To keep some pages out of geo processing, list them in Excluded URLs.
What can a redirect rule do?
Each rule has a condition (country, browser language, both together, IP address, or URL parameter), one or more actions (switch store view, switch currency, redirect to URL, restrict access) and the store views it applies to.
Each rule also has a priority, which decides the result when several rules match the same visitor.
Why might the redirect not work?
The most common reason is page caching such as Varnish. Ajax mode, which is on by default, checks the location after the cached page loads; if it was turned off, turn it back on.
Behind Cloudflare or another proxy, choose the header that carries the real visitor IP in Remote IP key. If the country can't be detected, the reason is written to var/log/mirasvit/geo-ip.log.
Why do customers see the redirect popup again after they already made a choice?
The visitor's answer is stored in the session or in a cookie, depending on the Redirect data storage setting. When the session or cookie expires, the module no longer knows the choice and shows the popup again.
Choose cookies and set a longer Storage lifetime to remember the choice for longer.
Do I need to buy a MaxMind license?
No. The module uses the free GeoLite2 database by MaxMind. You need a free MaxMind account: enter its Account ID and License Key in the settings, and the module downloads the database and updates it weekly. You can also download it with bin/magento mirasvit:geolocation:download.
If you don't want to create an account, switch the lookup source to the ip-api.com service, which needs no key.
Does it work behind Cloudflare or another CDN?
Yes. Behind a CDN or proxy, the server can see the proxy's IP instead of the visitor's. In Remote IP key, choose the header that carries the real IP, such as CF-Connecting-IP for Cloudflare or X-Forwarded-For. The setting shows the IP each header currently returns, so you can see which one is right.
Will it interfere with checkout or payment callbacks?
The module acts only on regular page views (GET requests), so form submissions and payment callbacks sent as POST requests are not redirected. To keep specific pages out of geo processing completely, add them to Excluded URLs.
mirasvit/module-geo-ip-hyva is gone: the redirect popup and the script behind store, currency and redirect rules are part of GeoIP Redirect itself, and one template now serves Luma and Hyvä alike, on every supported Magento version including 2.3. There is no longer an extra package to find and keep in step, and a Luma store gets nothing it does not use. Composer removes the companion package by itself when you upgrade, and a project composer.json that still requires mirasvit/module-geo-ip-hyva keeps installing without errors — GeoIP Redirect now stands in for it.setup:upgrade, then deploy static content as usual:Mirasvit_GeoIp::js.phtml on both themes. An override of Hyva_MirasvitGeoIp::js.phtml in a Hyvä theme, or of the Mirasvit_GeoIp/js/popup / Mirasvit_GeoIp/js/process scripts (or a RequireJS mixin on them) in a Luma theme, is no longer read — silently, with no error. Move such customisations onto Mirasvit_GeoIp::js.phtml. The Hyva_MirasvitGeoIp module no longer exists.mstGeoIpPopupOpen, mstGeoIpProcessRedirectAccept, mstGeoIpProcessRedirectDone, …), and a jQuery $(window).on(…) handler still receives them, but any payload is now in event.detail. Block\Js::getJsConfigProcess() and getJsConfigPopup() are replaced by getConfigJson(), the popup config no longer carries isShowRequest, and the block's constructor no longer takes WorkflowService./null page.mst-geo-ip CSS class is present from the first frame, so custom popup styles no longer flash in after it opens./sale.html on a German rule opens the German store's sale page. It used to switch the store and stay on the current page (or the store's home page), ignoring the redirect URL, unless a ?___store= parameter was added to it by hand. Enter the URL without a store code; it is matched to the target store's own address of that page. This works whether the store is switched on page load, in AJAX mode or from the popup's Accept button, and a currency or redirect rule that runs afterwards keeps the visitor on that page in the new store.?utm_source=…, ?omnisendContactID=… and other campaign or tracking parameters were lost. They are now carried over for every page, including the home page (/?utm_source=x). Magento's store-switch parameters (___store, ___from_store, uenc) are removed from the carried query so they can't send the visitor back to the original store.* as a wildcard (for example /contact or /promo/*); matching ignores letter case and a trailing slash. Prefix a pattern with a store code (/en_us/contact) to exclude the page in that store view only; without a prefix it applies to every store view of the website. Patterns that would match every page (/ or /*) are rejected on save, so the module cannot be switched off by accident.var/log/mirasvit/geo-ip.log. Previously, when the GeoLite2 database was unavailable or the ip-api.com service did not respond, visitors were simply left unmatched with no trace of the cause — now the reason is recorded while visitors keep browsing normally./us/, /fr/) when "Redirect Destination" is set to "Same Page"Blog
We are committed to being open and transparent with our customers. When you purchase our module, you automatically receive one year of free support service and free updates.
Why is this important?
- Seamless Installation and Configuration: We understand that setting up a new module can take time to configure according to your specific needs. That’s why we offer a full year of free support. Our experienced team is here to assist you with installation, configuration, and any questions you might have. We're eager to share our expertise to ensure you get the most out of your purchase.
- Stay Updated with Magento (Adobe Commerce) Releases: Magento releases new versions approximately every three months. These updates can sometimes introduce compatibility challenges. To keep your store running smoothly, we provide a year of free access to the latest versions of our modules, ensuring that you can upgrade Magento and our modules without encountering any obstacles.
- Subscription Included: Renewing your subscription ensures continued access to the latest updates and support from our team. This means you can be confident that any issues you encounter with the extension will be resolved quickly and efficiently. You can cancel your subscription at any time without any additional fees.
These are our primary. A major portion of our new clients come from referrals from our existing clients. Our professional team of developers, marketers and support staff have invested the best knowledge and experience in the field into our work, so you know you can come back to us again and again.
One year free and high quality support. We go to great lengths to provide maximum satisfaction with every module you have purchased in our store. By helping you with installation, configuration, answering your every question, we do all our best to eliminate any possible problems.
30-days money back guarantee. If you are not satisfied with our extension performance for any reason, we provide a full refund.
We constantly add new features to all our modules, and are always interested in hearing your opinion and implementing your suggested features in our future developments.
We provide an expanded user guide for every aspect of our extension, so you can find answers for all your burning questions.
You can customize extension according to your needs and requirements.
The Module is easy to install and upgrade, just follow our step-by-step user guide. Additionally, the extension is ready to use with the Hyvä theme.
No core modifications. The extension has been tested in a Magento Cloud environment and is fully compatible with it.
Andriy Kovalenko