Giter Club home page Giter Club logo

geomate's Introduction

GeoMate plugin for Craft CMS 5.x

GeoMate is a friend in need for all things geolocation. IP to geo lookup, automatic redirects (based on country, continent, language, etc), site switcher... You name it.

Screenshot

Requirements

This plugin requires Craft CMS 5.0.0-beta.2 or later. The plugin also requires the zlib PHP extension.

IMPORTANT UPDATE

As of December 30th 2019, the GeoLite2 databases are no longer publicly available due to compliance with GDPR and CCPA. Previously, the public URLs for these databases were set as defaults in the GeoMate configuration. As of GeoMate 1.1.0, these have been removed, and you now need to register a maxmind account, get a license key, and configure the download URLs yourself. See the "Downloading the geolocation database" below for more info on how to do this.

As before, you can also download the database manually and put it in your dbPath yourself.

Installation

To install the plugin, either install it from the plugin store, or follow these instructions:

  1. Install with composer via composer require vaersaagod/geomate from your project directory.
  2. Install the plugin in the Craft Control Panel under Settings → Plugins, or from the command line via ./craft install/plugin geomate.
  3. For GeoMate to do anything, you need to configure it, and download the geolocation database.

GeoMate Overview

GeoMate helps you detect the location and language preferences of you visitors, and lets you set up fine-grained rules to help you redirect users to the correct site, or show location/language specific information in your templates.

GeoMate relies on self-hosted Maxmind GeoIP2 databases for geolocation, and no external services are needed to look up IP information. By default GeoMate use the free Maxmind GeoLite2 database, but can easily be configured to use commercial versions of the database as long as it's in the MaxMind DB file format.


Downloading the geolocation database

For GeoMate to be able to get information about an IP address, you need to download a GeoIP2 database. The easiest way to get one, is to use Maxmind's free GeoLite2 database. For better results and more frequent updates, you should consider their commercial alternatives.

To get the GeoLite2 database, you first need to sign up for an account at Maxmind. Once you have access to your users control panel, you need to create a license key. Finally, you can get the download URL by going to the direct download page, and let GeoMate know about them by setting the countryDbDownloadUrl and cityDbDownloadUrl config settings accordingly. At the time of writing, the URLs should be (replace YOUR_LICENSE_KEY with your license key):

'countryDbDownloadUrl' => 'https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-Country&license_key=YOUR_LICENSE_KEY&suffix=tar.gz',
'cityDbDownloadUrl' => 'https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-City&license_key=YOUR_LICENSE_KEY&suffix=tar.gz',

Please note, although this is the recommended approach, you can also just download the files manually, or through some other mechanism, and put them in the dbPath yourself.

GeoMate comes with a handy utility that helps you download the database. You can access it by going to Utilities > GeoMate from the control panel main menu. Please check that the settings is as desired, and download the databases by clicking the "Update now" button.

You can also download the database by accessing the geomate/database/update-database controller action directly, or set up a cron job that hits it at regular intervals. The action URL for your installation is shown in the utility.


Using GeoMate

You can get information about the user's location through the craft.geomate.country, craft.geomate.countryCode and craft.geomate.city template variables.

By configuring the redirectMap config setting, you can define the rules for what location or language information is required for each of your sites. If you want to automatically redirect your users to the appropriate site, you can enable the autoRedirectEnabled config setting, or you can use the craft.geomate.redirectInformation template variable to get the information inside your templates, and display a banner or popup to trigger the user to switch site.

GeoMate also provides a helper to build a site switcher, the craft.geomate.getSiteLinks template variable, and some twig functions, addOverrideParam and addRedirectParam, to add the necessary parameters to ensure that GeoMate picks up that the user has selected a specific site.

There's quite a few config settings that can be used to tweak stuff, so make sure you read through it to get an idea of what the defaults are, and how you can use them to your needs.

When working locally, you need to override the IP by using the forceIp config setting for GeoMate to do anything useful (since it would try to look up 127.0.0.1 if you didn't, and that won't return any results).


Configuring

GeoMate can be configured by creating a file named geomate.php in your Craft config folder, and overriding settings as needed.

cacheEnabled [bool]

Default: true
Enables or disables caching of IP data.

cacheDuration [string|int]

Default: 'P7D'
Duration that looked up IP data should be cached, set as a date interval string or an int indicating the number of seconds.

useSeparateLogfile [bool]

Default: true
When enabled, GeoMate will create and use its own log file named geomate.log in Craft's log path.

logLevel [int]

Default: \yii\log\Logger::LEVEL_ERROR
When using GeoMate's log file (ie useSeparateLogfile being set to true), you can specify what log levels should be logged. By default, only errors will be logged, but if you set it to \yii\log\Logger::LEVEL_WARNING or \yii\log\Logger::LEVEL_INFO you'll get more information.

dbPath [string]

Default: ''
Path to GeoIP databases. If none is given (default), the database will be stored in /storage/geomate or whichever path is defined as Craft's storage path.

countryDbFilename [string]

Default: 'GeoLite2-Country.mmdb'
File name of the GeoIP country database.

cityDbFilename [string]

Default: 'GeoLite2-City.mmdb'
File name of the GeoIP city database.

countryDbDownloadUrl [string|null]

Default: null
Download URL for the GeoIP country database.

cityDbDownloadUrl [string|null]

Default: null
Download URL for the GeoIP city database.

downloadDbIfMissing [bool]

Default: false
If a given database is missing when GeoMate tries to do an IP lookup, it'll fail silently, log the error, and not do a redirect or return any redirect information. If you enable this setting, GeoMate will try to download and unpack the database if it is missing.

Make sure you're certain that download works before enabling this. If something goes wrong during the download, GeoMate will continue to try on every request, which could take up alot of resources depending on what fails.

autoRedirectEnabled [bool]

Default: false
Set this to true to enable automatic redirects of users to sites based on the redirectMap config setting.

autoRedirectExclude [array]

Default: []
A list of site handles that should be excluded from automatic redirects.

redirectMap [array]

Default: []
This powerful config setting enables you to create detailed rules for redirecting users to your different sites, based on detected information about location or language.

The easiest way to use this setting is to map site handles to country codes:

'redirectMap' => [
    'norwegian' => 'no',
    'swedish' => 'se',
    'global' => '*' 
]

In this example, there are three sites with handles norwegian, swedish and global. Visitors from Norway is redirected to the norwegian site, visitors from Sweden are redirected to the swedish site, and the rest is sent to the global site.

By default, it's assumed that the value is the detected country code. If redirectMapSimpleModeKey is set to language though, the users browser language is used.

But, you can also use more advanced rules:

'redirectMap' => [
    'norwegian' => [
        'country' => 'no',
    ],
    'eu' => [
        'continent' => 'eu',
        'isInEuropeanUnion' => true
    ],
    'europe' => [
        'continent' => 'eu',
    ],
    'us' => [
        'country' => 'us'
    ],    
    'global' => '*' 
]

The rules are parsed top to bottom, and the first match is used. So swapping the order of eu and europe i the above example would make every visitor from europe go to the site with handle europe.

If you don't add a site with a wildcard rule (ie 'global' => '*'), the visitor will not get redirected from the site they landed on if no other rule matched.

You can also use the detected browser language when setting up your rules:

'redirectMap' => [
    'norsk' => [
        'language' => 'no',
    ],
    'us' => [ // matches 'en-US'
        'language' => 'en',
        'languageRegion' => 'us',
    ],
    'canada' => [ // matches 'en-CA'
        'language' => 'en',
        'languageRegion' => 'ca',
    ],
    'english' => [ // matches all english language codes, 'en', 'en-US', 'en-NZ', etc.
        'language' => 'en',
    ],
]

You can even use combinations of geolocation and language information, although that might get a bit... edge-case:

/*
 * We have this very special site that we only want to redirect
 * people to if they're located in Norway, but have a browser
 * with jamaican english as their preferred language (yeah, our 
 * site is all about norwegian reggea and jerk chicken).
 */
'redirectMap' => [   
    'special' => [
        'country' => 'no',
        'language' => 'en',
        'languageRegion' => 'jm'
    ],
    'normal' => '*' 
]

The values in the redirect map can also be arrays:

'redirectMap' => [
    'scandinavia' => [
        'country' => ['no', 'se', 'dk', 'fi'],
    ],
    'europe' => [
        'continent' => 'eu',
    ],
    'global' => '*' 
]

Please note that this setting is not only used when autoRedirectEnabled is set to true, but also when you use craft.geomate.redirectInformation.

redirectMatchingElementOnly [bool]

Default: false
When set to true, matching based on the redirectMap will only happen if the request has a matched element, and that element is available in the matched site. When set to false, the user will be redirected to the root of the matched site, if a matching element could not be found.

redirectMapSimpleModeKey [string]

Default: 'country'
When using the simple syntax for redirectMap, by default it's assumed that the value is a country code. When set to 'language', it will instead be matched with accepted languages.

redirectIgnoreBots [bool]

Default: true
By default, bots will not be redirected. Disable this to also redirect bots (may impact SEO, so beware).

redirectIgnoreAdmins [bool]

Default: true
By default, admins will not be redirected. Disable this to also redirect admin users.

redirectIgnoreUserGroups [array]

Default: []
An array of user groups that should not be redirect. Example:

'redirectIgnoreUserGroups' => ['editors', 'subscribers'],

redirectIgnoreUrlPatterns [array]

Default: []
An array of url patterns that should not be redirect. The patterns can use regexp, and matches towards the full path of the request. To do an exact match, you can prefix the patter with =.

Example:

'redirectIgnoreUrlPatterns' => [
     // Matches '/robots.txt' directly
    '=/robots.txt', 

     // Matches anything that starts with '/dont-redirect/'
    '/^\/dont-redirect\//',

     //Matches a range of sitemap urls like '/sitemap.xml', '/no/sitemap.xml', '/sitemap_portfolio_1.xml', etc.
    '/^\/(no\/|en\/)*sitemap([\s\S])*\.xml$/',
],

redirectOverrideCookieName [string]

Default: 'GeoMateRedirectOverride'
Name of the cookie that registers if a user has overridden the preferred site (via a site switcher for instance).

cookieDuration [int]

Default: 43200
Duration of the cookies.

addGetParameterOnRedirect [bool]

Default: false
By default, a session (flash) variable is set when a user is redirected, which is picked up by GeoMate to detect if the user was redirected. In some cases, this is not ideal, for instance if the site is served through a front-side cache (Cloudflare, Varnish, or similar) and you want to notify the user about being redirected. By enabling this parameter, a query string will be appended to the URL instead.

redirectOverrideParam [string]

Default: '__geom'
Name of the query string parameter that is added to the URL if the user overrides site redirection.

redirectedParam [string]

Default: '__redir'
Name of the query string parameter that is added to the URL if the user is redirected (and addGetParameterOnRedirect is true).

paramValue [string]

Default: '✪'
Value of the query string parameters that GeoMate add.

forceIp [null|string]

Default: null
Force an IP to be used for geolocation lookup. In local environments, this needs to be set to a valid IP address for GeoMate to work, since your local IP won't return any results. Can also be used to debug IP's from different locations.

fallbackIp [null|string]

Default: null
You can supply a fallback IP that will be used if the supplied IP can't be found. It's probably a good idea to not use this, and instead implement some default functionality in your templates instead.

minimumAcceptLanguageQuality [int]

Default: 80
The Accept-Language header supplied by the browser may contain any number of languages, which all have a quality parameter (in this case, the range is from 0 to 100) that indicates how proficient the user is in these languages. This parameter indicates what quality level a language needs to have for GeoMate to consider it a valid language.


Template variables

craft.geomate.country([ip=null])

Returns country information in the form of a \GeoIp2\Model\Country model. If no information is found, null will be returned.

By default the IP address of the current request will be used, but you can also use the optional ip parameter to get information based on a specific IP.

craft.geomate.countryCode([ip=null])

Returns the two-character country code as a string. If no information is found, null will be returned.

By default the IP address of the current request will be used, but you can also use the optional ip parameter to get information based on a specific IP.

craft.geomate.city([ip=null])

Returns country information in the form of a \GeoIp2\Model\City model. If no information is found, null will be returned.

By default the IP address of the current request will be used, but you can also use the optional ip parameter to get information based on a specific IP.

craft.geomate.redirectInformation([ip=null])

Returns redirect information based on your redirect configuration as a RedirectInfo model. This information can be used to display information to the user about which site you think they should visit, and let them switch if they want. Example:

{% set redirectInfo = craft.geomate.redirectInformation() %}

{% if redirectInfo %}
    <div class="popup">
        <p>
            You are currently visiting our {{ currentSite.name }} site. 
            <a href="{{ redirectInfo.url | addOverrideParam }}">Click here</a> to go to our {{ redirectInfo.site.name }} site.
        </p>
    </div>
{% endif %}

By default the IP address of the current request will be used, but you can also use the optional ip parameter to get information based on a specific IP.

craft.geomate.isCrawler()

Returns true if the current request is from a crawler.

craft.geomate.isRedirected()

Returns true if the current request was redirected.

craft.geomate.isOverridden()

Returns true if the user has overridden the preferred site.

craft.geomate.getSiteLinks()

Returns an array of objects containing sites and redirect URLs for each of them. Useful for building site switchers, for instance like this:

{% set siteLinks = craft.geomate.getSiteLinks() %}
<nav>
    <ul>
        {% for siteLink in siteLinks %}
            <li><a href="{{ siteLink.url | addOverrideParam }}">{{ siteLink.site.name }}</a></li>
        {% endfor %}
    </ul>
</nav>

craft.geomate.getLanguages()

Return an array of AcceptedLanguage models, containing information about the users preferred browser languages.

{% set languages = craft.geomate.getLanguages() %}
{% for language in languages %}
    <p>
        Quality: {{ language.quality }}<br>
        Language: {{ language.language }}<br>
        Region: {{ language.region }}<br>
        Script: {{ language.script }}
    </p>
{% endfor %}

Twig filters

addOverrideParam

Adds the override param and value to an URL. You should always add this when linking between your sites, for instance in a site switcher.

addRedirectParam

Adds the redirect param and value to an URL. Not really that useful, but it's there. :)


Price, license and support

The plugin is released under the MIT license, meaning you can do what ever you want with it as long as you don't blame us. It's free, which means there is absolutely no support included, but you might get it anyway. Just post an issue here on github if you have one, and we'll see what we can do.

Changelog

See CHANGELOG.MD.

Credits

Brought to you by Værsågod

This product includes GeoLite2 data created by MaxMind, available from http://www.maxmind.com.

Icon designed by Freepik from Flaticon.

geomate's People

Contributors

adamskyle avatar aelvan avatar johnnynotsolucky avatar mmikkel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

geomate's Issues

Don't show MaxMind DB Warning if browser language is used

I use this extension for browser based redirects only. Would be nice if the following 2 warnings would not show up if the plugin is configured to only use browser based redirects.

  • Database download URLs have not been configured.
  • No database found! Please check the settings below, and download the GeoIP2 databases.

redirectIgnoreUrlPatterns for subdomains or site handles

Hello, I currently have a localized site with redirectMap setting shown below. I recently added a fourth site in Craft to serve content to a subdomain, however the redirectMap is redirecting all requests to the subdomain based off of the redirect settings. Is there a way to ignore the subdomain and/or site handle?

'redirectMap' => [
'au' => [
'continent' => ['au', 'oc'],
],
'uk' => [
'continent' => 'eu',
],
'default' => '*',
],

Support for Base URLs using Environment Variables

The sites in this Craft install all get there Base URLs from ENV vars:
https://d.pr/i/dlmcNP

When I am testing the redirectMap locally with these config settings:

return [
    'cacheEnabled' => true,
    //'dbPath' => '',
    'autoRedirectEnabled' => true,
    'redirectMap' => [
    	'www' => 'us'
    	],
    'redirectIgnoreBots' => false,
    //use the following for testing locally
    'redirectIgnoreAdmins' => false,
    'forceIp' => '72.35.132.254'
 ];

The redirect happens, but the resulting URL is http://store.gcx.craft/$SITE_URL_WWW - it appears that possibly GeoMate isn't parsing the ENV Vars in the site settings. If that's not the case and I have a config issue, let me know what you think may fix it. Otherwise, parsing ENV Vars is a feature request.

Thanks.

Allow disabling override paramter value completely

It might be a good idea to do away with the need to set a value to the override parameter, or at least allow setting it to null, so that the resulting URL can be cleaner eg. xyz.com/?switch-lang.

Setting paramValue to null currently leads to a URL like xyz.com/?switch-lang=.

redirectIgnoreUrlPatterns not working for auto redirect

I have a website with a multi-site setup

I need a plugin to auto redirect only for the base url (*.example.com) with subdomains and ignore any other urls (including the one with language handles)

For that I'm trying to use redirectIgnoreUrlPatterns param with passing a regex to it

^(.*example\.com\/.*.$).*$

Schermafbeelding 2020-07-06 om 14 51 15

So the one highlighted with green should be ignored for auto redirection

Schermafbeelding 2020-07-06 om 14 59 12

However the plugin does not ignore those urls for some reason and keeps auto redirecting them.
Is there something I do wrong ?

Change language output settings

Please tell me how to correctly change the settings in the abyss language change in the GeoMate plugin, just like on the site Apple.com

When you go to the site a menu appears with a proposal to go to your region
Снимок экрана 2020-07-14 в 14 39 23

Can't get geomate.php custom config to work

I can't seem to get GeoMate to work in my setup. For my site, I'm using craft3-multi-environment configurations. I've successfully downloaded GeoMate and downloaded the geolocation database, but none of the GeoMate variables are working. (e.g. craft.geomate.country, craft.geomate.countryCode).

Based on the docs, I have a feeling the source of the issue is the geomate.php config file I created and added to the Craft config folder. I have the following configs, but it doesn't seem to take. In fact, the config settings just show up at the top of my web pages above my _layout.twig.

'forceIp' => 'IP-NUMBER-HERE',

'autoRedirectEnabled' => true,

'redirectMap' => [
    'korean' => 'ko',
    'global' => '*'
]

I'm pretty sure this is a user error on my end. But just in case, I was thinking it could possibly be an issue with the craft3-multi-environment set up I have. Any guidance would be greatly appreciated. Thanks much!

doesn't do anything?

  • configured geomate.php
  • downloaded GeoLite db's
  • {{ dump(craft.geomate) }} and {{ dump(craft.geomate.country()) }} return null

The MaxMind DB file's search tree is corrupt

So I'm using v1.1.0 and I'm getting this error in the Craft logs:

Database read error (InvalidDatabaseException) :: The MaxMind DB file's search tree is corrupt

I've removed the old databases and re-downloaded the new ones from the new URL setup and still getting the same results.cacheEnabled is set to false in my config file.

Any ideas?

Site Groups

How would I configure Geomate to work within site groups that have the same language codes?

i.e. I have 2 sites, each with the same 2 languages. I have set them up in Site Groups so SEOMatic will do its magic. I need a way to make sure that Site B never redirects to Site A when it's redirecting based on an IP address. Is there some sort of config that I can tap into within Geomate to make that possible? If there is, I'm not sure what I'm missing or how I should set it up...

Thank you.

Downloading the geolocation database URL's incorrect?

in the docs, under "Downloading the geolocation database URL's", there are two URL's listed.

The cityDbDownloadUrl has the license key placeholder wrapped in back tick/grave accent, but countryDbDownloadUrl doe not. Removing the back ticks/grave accents worked for me.

'countryDbDownloadUrl' => 'https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-Country&license_key=YOUR_LICENSE_KEY&suffix=tar.gz',
'cityDbDownloadUrl' => 'https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-City&license_key=`YOUR_LICENSE_KEY`&suffix=tar.gz',

Does this work with Cloudflare?

When using Cloudflare, the visitors IP on the server is Cloudflares.

So therefore will this plugin work, or any additional work needed to get it to work?

Thanks

redirectMatchingElementOnly not working as expected

Hi, in a current project where we want to use geomate, i use this option and expected, that there will be no redirect to a 404, if an entry in a target-site(language) doesn't exist.
No matter if the current section is enabled for the target-site or not.

For example:
My section is enabled for english, spanish and frensh sites (SiteID 1-3)
My testentry is configured as this:
www.domain.com/testentry --> enabled
www.domain.com/es/testentry --> entry disabled for spanish site
www.domain.com/fr/testentry --> enabled

If i enter the root-page-url with a frensh IP, i get redirected
(www.domain.com/ ---> www.domain.com/fr/).
Spanish IP will do the same
(www.domain.com/ ---> www.domain.com/es/)
Fine.

If i enter the testentry-url with spanish ip, i get redirected correctly
(www.domain.com/testentry ---> www.domain.com/es/testentry).
But if i enter with a frensh IP, i also get redirected
(www.domain.com/testentry ---> www.domain.com/fr/testentry).
This ends up in a 404. This should not happen i think.

After debugging the plugin, i found the "getElementById" usage.
If i extend the function like this:

 $enabledSites = Craft::$app->getElements()->getEnabledSiteIdsForElement($currentElement->id);
 if ($elementMatchOnly && !in_array($site->id, $enabledSites)) {
     $url = '';
 }

the behaviour is as expected, no redirect for the frensh Url.
Seems to be a bug, because i can not find any misconfiguration.

Is there a way to overwrite autoRedirectEnabled value

Whenever I configurate autoRedirectEnabled to be true I get the correct results. However the issue is that users can't change to another language manually. Is there a way to allow this while keeping the first visit redirect to the correct language?

Error "Class 'Locale' not found" when using redirectMapSimpleModeKey => language

Great plugin, thank you very much! However, I think I'm doing something wrong: I set up the plugin with the config as follows:

    // Redirect automatically
    'autoRedirectEnabled' => true,

    'redirectMap' => [
        'nl' => 'nl',
        'fr' => 'fr',
        'en' => '*'
    ],

    'redirectIgnoreAdmins' => false,
    'forceIp' => _my-ip-address_,

And this works, I get redirected. However, when I add "'redirectMapSimpleModeKey' => 'language'," to the config, any page I visit gives the following error:

Class 'Locale' not found

The same happens when I use "craft.geomate.getLanguages()" in my templates (with and without setting the redirectMapSimpleModeKey option to true).

Auto creation of redirectMap

How can we have the redirectMap auto created based on the sites we already have setup? If my customer creates a new site, I dont want to have to manually add it to the config, when the config array would just replicate the Sites list. Our site handles are the same as the country codes you see.

Here are our sites country codes in an array, then the config array we need to create. Identical.

'ourSitesInAnArray' => [
    'ua' => 'us',
    'ca' => 'ca',
    'au' => 'au' 
]
'redirectMap' => [
    'ua' => 'us',
    'ca' => 'ca',
    'au' => 'au' 
]

So ideally just create redirectMap from the Sites.

It would be great to then override it, so we can add in:
redirectMap['uk'] = 'gb';

Compatibility with Azure Traffic Manager

Hi there - I'm trying to get this plugin to work with Azure Traffic Manager, distributed to two servers. It seems to be looking up the IP of the traffic manager server, rather than the end user's IP. Looking at geomate.log, the value I want to test against is being reported at 'HTTP_X_FORWARDED_FOR'. Is this something one could change with a config?

How to access geomate data in another plugin?

Sorry if this is obvious and my lack of understanding of craft, but I have a custom plugin in which I have a function to check certain access criteria, one of which is being in a certain country.

So within my custom plugin I would like to access craft.geomate.countryCode

Is this possible, do you know how please?

Thanks

Null from craft.geomate.redirectInformation()

Having installed Geomate via composer I can access all craft.geomate.country, craft.geomate.countryCode and craft.geomate.city within my templates. HOWEVER I have been unsuccessful in retrieving anything except NULL from redirect information.

geomete.php (in config folder) looks like...

<?php
return [
    'autoRedirectEnabled' => true,
    'redirectIgnoreAdmins' => false,
    'redirectMap' => [
        'eu' => [
            'continent' => 'eu',
            'isInEuropeanUnion' => true
        ],
        'europe' => [
            'continent' => 'eu',
        ],
        'us' => [
            'country' => 'us'
        ],    
        'global' => '*' 
    ]
];

While in my template files I am using...

{% set redirectInfo = craft.geomate.redirectInformation() %}
{{ dump(redirectInfo) }}

Sorry, what am I doing wrong?

Error on Craft::parseEnv

We have a customer on an older version of Craft 3.0.x, which won't run GeoMate, since it's using Craft::parseEnv(), which was added in 3.1.0. So you might want to set the required version to 3.1.0.

Changes to GeoLite 2 Free Downloadable Databases

I tried updating the databases and got the following message

An error occured! Please check your settings and try again.

I thought maybe it was a permissions issue. I finally tried visiting http://geolite.maxmind.com/download/geoip/database/GeoLite2-Country.mmdb.gz and got an error:

geolite.maxmind.com’s server IP address could not be found.

So then I did a Google search and found these links that might be relevant:

Some pertinent information from that last link:

Starting December 30, 2019, downloads will no longer be served from our public GeoLite2 page, from geolite.maxmind.com/download/geoip/database/*, or from any other public URL. See the section below for steps on how to migrate to the new download mechanism.

GeoLite2 Databases Affected

  • GeoLite2 Country
  • GeoLite2 City
  • GeoLite2 ASN

Steps for Migration

  • Sign up for a MaxMind account (no purchase required)
  • Set your password and create a license key
  • Setup your download mechanism by using our GeoIP Update program or creating a direct download script

I haven't tried setting up a MaxMind account yet (going to here shortly) but I'm guessing that once I do I should be able to get a new link and I could used that link in the GeoMate config.php file. I'll report back here with any updates.

Caching Issue - popup keeps coming back, sometimes different country links, sometimes doesn't popup when should

I am quite confused about this issue... the code we use is below. But it seems to me that the output of this code is being cached. Issues we see are, different countries popping up in our popup and the popup not going away, so clicking a country to change to the popup comes back.

If I clear Craft caches it seems to reset it itself.

We are not using template caching around this popup code.

So it seems to me there is an issue with craft.geomate.redirectInformation(), as if its caching the output of it, then when the next person comes to the page, its showing the last result and therefore popping up the code, even when the _geom attribute is past.

So could your plugin be caching the output? We do use Craft cache on a few other templates but they are not around this, they are in other include templates.

Thanks

{% set redirectInfo = craft.geomate.redirectInformation() %}

{% if redirectInfo and craft.request.firstSegment != 'members' %}
	
	{% set targetSiteSettings = craft.app.globals.getSetByHandle('siteSettings', redirectInfo.site.id) %}
	{% set currentSiteSettings = craft.app.globals.getSetByHandle('siteSettings', currentSite.id) %}
	
	{% set currentCountryFlag = currentSiteSettings.countryFlag.first() %}
	{% set targetCountryFlag = targetSiteSettings.countryFlag.first() %}
	

	<div class="reveal" id="countryRedirectPopup" data-reveal>

		<p>{{ strings('Please select the country version of the website you would like to view')}}</p>
		
		<br/>

		{% set targetUrl =  siteUrl(craft.request.getPath(), siteId=redirectInfo.site.id) %}
		{% set currentUrl =  siteUrl(craft.request.getPath()) %}
		
		<a href="{{ targetUrl | addOverrideParam }}"><img src="{{ targetCountryFlag.url }}" width="30" height="20">  {{ redirectInfo.site.name }}</a>
		
		<br/>
		<br/>
		
		<a href="{{ currentUrl | addOverrideParam }}"><img src="{{ currentCountryFlag.url }}" width="30" height="20"> {{ currentSite.name }}</a>
		
		<br/>
		<br/>
		
		<img src="/assets/img/logo_small.png" width="200" height="49">

		<button class="close-button" data-close aria-label="Close modal" type="button">
			<span aria-hidden="true">&times;</span>
		</button>

	</div>


{% endif %}

Option to redirect user only once

I have a website with a multi-site setup.

Currently, there is an option to enable automatic redirects of users to sites based on the redirectMap config setting.

In my case, I need my user to be redirected only once they enter the homepage, and after that then they can switch the language if they need, and they will not be redirected.

But for me now it redirects automatically whenever I go to some page, even if I switch the language on the website or type language site handler ('/es').

Is there a possibility to set the redirection only once, or set automatioc redirection only on a base url ('www.site.com')and exclude all urls with site handlers ('www.site.com/es') from automatic redirection? Thank you in advance.

geomate.php
<?php return [ 'redirectIgnoreAdmins' => false, 'autoRedirectEnabled' => true, 'redirectMap' => [ 'nl' => ['nl','NL'], 'uk' => ['uk','UK'], 'de' => ['de','DE'], 'es' => ['es','ES'], 'en' => '*' ] ];

My multi-site conf
Schermafbeelding 2020-07-01 om 12 03 53

Direct URL on different site redirects to home page of preferred site, not equivalent page

If I switch to a different country, so my site preference is set, and then go direct to a URL on a different site, I get redirected to my preferred site home page, whereas actually I would exepect it to redirect to the equivalent page I was on.

  1. Go to www.myhomepage.com
  2. Change to say FR, www.myhomepage.com/fr/?__geom=✪
  3. Click a link or change URL to www.myhomepage.com/whateverpage
  4. I get redirected to www.myhomepage.com/fr/ and NOT www.myhomepage.com/fr/whateverpage

Although this only works if the slugs are all the same, if the slugs are foreign it goes to a 404 anyway. I dont suppose you can guess a site URL from the foreign slug and do a redirect to the page without the country code?

Thanks

Since updating to Craft 3.7 there have been many reports of re-direct loops occurring resulting in time outs

We updated to Craft Pro 3.7.7 and geomate 1.3.1.1 recently, and we're getting reports of customers all over the world not being able to access the site as they are seeing a 'Too many re-directs' error.

I have run the garbage clear function to ensure there are no stale cookies or sessions. this seemed to fix for a day or so but now its occuring again.

For the time being, we've turned off auto-redirect but we need to get it back up and running asap as customers are landing on the wrong site for their location.

We have our default en-GB site at www.thewriter.co.uk and our US en-US site at www.thewriter.com

<?php

return [
    'autoRedirectEnabled' => (bool)getenv('GEOMATE_AUTOREDIRECT_ENABLED'),
    'redirectMap' => [
        'default' => 'gb',
        'theWriterUS' => '*'
    ],
    'countryDbDownloadUrl' => 'https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-Country&license_key=AH2AhDkFVHz4x4iK&suffix=tar.gz',
    'cityDbDownloadUrl' => 'https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-City&license_key=AH2AhDkFVHz4x4iK&suffix=tar.gz',
    'redirectIgnoreAdmins' => false,
    'redirectOverrideCookieName' => 'GeoMateRedirectOverride',
    'cookieDuration' => 43200,
    'redirectIgnoreUrlPatterns' => [
        '/^\/seomatic\//',
        '/^\/freeform\//'
    ],
];

As the error doesn't store any errors in the logs I do not know how best to de-bug this. Can you help?

Is there a way to autoRedirectEnabled only on first time page load?

Hello, I have got GeoMate working now. I set it up like this.

      'autoRedirectEnabled' => 'true',

      'redirectMap' => [
         'usa_en' => [
            'country' => 'us'
         ],
         'canada_fr' => [ // matches 'fr-CA'
            'language' => 'fr',
            'languageRegion' => 'ca',
         ],
         'canada_en' => [ // matches 'en-CA'
             'language' => 'en',
             'languageRegion' => 'ca',
         ]
     ]

First, it only redirects if I am using a USA IP, but if I'm in Canada, it just doesn't redirect, is it possible to redirect a user if he is in Canada, and the browser language is set to French to be redirected to 'canada_fr' and if a user is Canada with browser language English, to be redirected to 'Canada_en'? What am I missing?

Second, if the user gets redirected to the US country site because he is traveling, but actually wants to go to Canadian site, is there a way to let the user click on Canada on the site, and 'autoRedirectEnabled' allows it? Or is there a way to have "autoRedirectEnabled" only for first-time visit, but then if the user selects a different country site language he is directed to that one instead?

Thank you.

Problems with segments

Hello,

first of all, thank you for this great plugin. It's fantastic!
I think I've a problem with the segments.

This is the situation: I've a site (not yet online) with 2 languages.

  • case 1: example.com/room
    If i pick one of the two languages I get redirect to the homepage (and not to the same page, translated, as expected).
    The url I get is something like: example.com/en?__geom=✪

  • case 1: example.com/room/test
    it works like a charm. I can switch between the translated versions of the same page
    The url I get is something like: example.com/en/room/test?__geom=✪

My link is simple as this:

<li>
       <a href="{{ siteLink.url | addOverrideParam }}">
           {{ siteLink.site }}
       </a>
</li>

My geomate.php file is like this:

return [
    'autoRedirectEnabled' => true,
    'redirectIgnoreAdmins' => false,
    'redirectMap' => [
        'italiano' => 'it',
        'inglese' => '*' 
    ]
];

What do you think? Can you please help me?
Thank you!

Site suggestion is remembering the last country site, not my IP country site

Hi

The wrong site is being suggested when we visit a new site. Its suggesting the previous site I was on, not the site where my IP is.

So for example, I am in the UK and I visit the US site, it pops up at first asking if I want to visit the US site or the UK site, all OK.

Lets say I go to the USA, not my country site which is UK.

If I then use the site switcher, which is your code, to go to say Italy, and I manage to get the popup again, it would ask if I want to go to the USA site or the Italy site. If I go to Italy and then a new country site and then get the switcher it asks me if I want to go to the Italy site or the new site.

So the site info in craft.geomate.redirectInformation() is remembering the last site I was on, NOT the site for my IP address.

Full code:

{% set redirectInfo = craft.geomate.redirectInformation() %}
	
{% if redirectInfo %}

	{% set targetSiteSettings = craft.app.globals.getSetByHandle('siteSettings', redirectInfo.site.id) %}
	{% set currentSiteSettings = craft.app.globals.getSetByHandle('siteSettings', currentSite.id) %}
	
	{% set currentCountryFlag = currentSiteSettings.countryFlag.first() %}
	{% set targetCountryFlag = targetSiteSettings.countryFlag.first() %}
	

	<div class="reveal" id="countryRedirectPopup" data-reveal>

		<p>{{ strings('Please select the country version of the website you would like to view')}}</p>
		
		<br/>
		
		<a href="{{ redirectInfo.url | addOverrideParam }}"><img src="{{ targetCountryFlag.url }}" width="30" height="20"> {{ redirectInfo.site.name }}</a>
		
		<br/>
		<br/>
		
		<a href="{{ currentSite.baseUrl | addOverrideParam }}"><img src="{{ currentCountryFlag.url }}" width="30" height="20">{{ currentSite.name }}</a>
		
		<br/>
		<br/>

		<button class="close-button" data-close aria-label="Close modal" type="button">
			<span aria-hidden="true">&times;</span>
		</button>

	</div>


{% endif %}

Config:

return [
	'redirectMap' => [
	    'uk' => 'gb',
	    'us' => 'us',
	    'de' => 'de' ,
	    'ko' => 'ko',
	    'it' => 'it',
	    'es' => 'es'	
	],
];

Thanks

Error Undefined index: HTTP_ACCEPT_LANGUAGE when using redirectMapSimpleModeKey => language

Hello,

When I switch redirectMapSimpleModeKey to language some bots cannot access the page, the following error occurs:
2019-07-02 10:33:27 [-][-][b0b9cbc6df7eb8d9cde749fb1237c255][error][yii\base\ErrorException:8] yii\base\ErrorException: Undefined index: HTTP_ACCEPT_LANGUAGE in /public_html/domain.xyz/vendor/vaersaagod/geomate/src/helpers/GeoMateHelper.php:68

Could you help me here out?

Regards

No plugin exists with the handle "geomate".

I have a problem, Output message No plugin exists with the handle "geomate". at installing plugin geomate.
And the following is logs:
2020-03-10 23:03:18 [-][14658][qqhpqgk2rlk8rce38eajjg2056][trace][yii\base\Controller::runAction] Route to run: plugins/install-plugin 2020-03-10 23:03:18 [-][14658][qqhpqgk2rlk8rce38eajjg2056][trace][yii\base\InlineAction::runWithParams] Running action: craft\controllers\PluginsController::actionInstallPlugin() 2020-03-10 23:03:18 [-][14658][qqhpqgk2rlk8rce38eajjg2056][info][yii\db\Command::query] SELECT id, handle, version, schemaVersion, licenseKeyStatus, installDate, licensedEditionFROMcraft_pluginsWHEREhandle='geomate' LIMIT 1 2020-03-10 23:03:18 [-][14658][qqhpqgk2rlk8rce38eajjg2056][profile begin][yii\db\Command::query] SELECT id, handle, version, schemaVersion, licenseKeyStatus, installDate, licensedEditionFROMcraft_pluginsWHEREhandle='geomate' LIMIT 1 2020-03-10 23:03:18 [-][14658][qqhpqgk2rlk8rce38eajjg2056][profile end][yii\db\Command::query] SELECT id, handle, version, schemaVersion, licenseKeyStatus, installDate, licensedEditionFROMcraft_pluginsWHEREhandle`='geomate'
LIMIT 1
2020-03-10 23:03:18 [-][14658][qqhpqgk2rlk8rce38eajjg2056][error][craft\errors\InvalidPluginException] craft\errors\InvalidPluginException: No plugin exists with the handle "geomate". in /data/stagingroot/craft3/vendor/craftcms/cms/src/services/Plugins.php:1380
Stack trace:
#0 /data/stagingroot/craft3/vendor/craftcms/cms/src/services/Plugins.php(819): craft\services\Plugins->_getPluginConfigData('geomate')
#1 /data/stagingroot/craft3/vendor/craftcms/cms/src/services/Plugins.php(469): craft\services\Plugins->getStoredPluginInfo('geomate')
#2 /data/stagingroot/craft3/vendor/craftcms/cms/src/controllers/PluginsController.php(50): craft\services\Plugins->installPlugin('geomate', NULL)
#3 [internal function]: craft\controllers\PluginsController->actionInstallPlugin()
#4 /data/stagingroot/craft3/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#5 /data/stagingroot/craft3/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#6 /data/stagingroot/craft3/vendor/craftcms/cms/src/web/Controller.php(178): yii\base\Controller->runAction('install-plugin', Array)
#7 /data/stagingroot/craft3/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller->runAction('install-plugin', Array)
#8 /data/stagingroot/craft3/vendor/craftcms/cms/src/web/Application.php(291): yii\base\Module->runAction('plugins/install...', Array)
#9 /data/stagingroot/craft3/vendor/craftcms/cms/src/web/Application.php(559): craft\web\Application->runAction('plugins/install...', Array)
#10 /data/stagingroot/craft3/vendor/craftcms/cms/src/web/Application.php(270): craft\web\Application->_processActionRequest(Object(craft\web\Request))
#11 /data/stagingroot/craft3/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request))
#12 /data/stagingroot/craft3/web/index.php(21): yii\base\Application->run()
#13 {main}
2020-03-10 23:03:18 [-][14658][qqhpqgk2rlk8rce38eajjg2056][trace][yii\base\View::renderFile] Rendering view file: /data/stagingroot/craft3/vendor/yiisoft/yii2/views/errorHandler/exception.php
2020-03-10 23:03:18 [-][14658][qqhpqgk2rlk8rce38eajjg2056][trace][yii\base\View::renderFile] Rendering view file: /data/stagingroot/craft3/vendor/yiisoft/yii2/views/errorHandler/callStackItem.php
2020-03-10 23:03:18 [-][14658][qqhpqgk2rlk8rce38eajjg2056][trace][yii\base\View::renderFile] Rendering view file: /data/stagingroot/craft3/vendor/yiisoft/yii2/views/errorHandler/callStackItem.php
2020-03-10 23:03:18 [-][14658][qqhpqgk2rlk8rce38eajjg2056][trace][yii\base\View::renderFile] Rendering view file: /data/stagingroot/craft3/vendor/yiisoft/yii2/views/errorHandler/callStackItem.php
2020-03-10 23:03:18 [-][14658][qqhpqgk2rlk8rce38eajjg2056][trace][yii\base\View::renderFile] Rendering view file: /data/stagingroot/craft3/vendor/yiisoft/yii2/views/errorHandler/callStackItem.php
2020-03-10 23:03:18 [-][14658][qqhpqgk2rlk8rce38eajjg2056][trace][yii\base\View::renderFile] Rendering view file: /data/stagingroot/craft3/vendor/yiisoft/yii2/views/errorHandler/callStackItem.php
2020-03-10 23:03:18 [-][14658][qqhpqgk2rlk8rce38eajjg2056][trace][yii\base\View::renderFile] Rendering view file: /data/stagingroot/craft3/vendor/yiisoft/yii2/views/errorHandler/callStackItem.php
2020-03-10 23:03:18 [-][14658][qqhpqgk2rlk8rce38eajjg2056][trace][yii\base\View::renderFile] Rendering view file: /data/stagingroot/craft3/vendor/yiisoft/yii2/views/errorHandler/callStackItem.php
2020-03-10 23:03:18 [-][14658][qqhpqgk2rlk8rce38eajjg2056][trace][yii\base\View::renderFile] Rendering view file: /data/stagingroot/craft3/vendor/yiisoft/yii2/views/errorHandler/callStackItem.php
2020-03-10 23:03:18 [-][14658][qqhpqgk2rlk8rce38eajjg2056][trace][yii\base\View::renderFile] Rendering view file: /data/stagingroot/craft3/vendor/yiisoft/yii2/views/errorHandler/callStackItem.php
2020-03-10 23:03:18 [-][14658][qqhpqgk2rlk8rce38eajjg2056][trace][yii\base\View::renderFile] Rendering view file: /data/stagingroot/craft3/vendor/yiisoft/yii2/views/errorHandler/callStackItem.php
2020-03-10 23:03:18 [-][14658][qqhpqgk2rlk8rce38eajjg2056][trace][yii\base\View::renderFile] Rendering view file: /data/stagingroot/craft3/vendor/yiisoft/yii2/views/errorHandler/callStackItem.php
2020-03-10 23:03:18 [-][14658][qqhpqgk2rlk8rce38eajjg2056][trace][yii\base\View::renderFile] Rendering view file: /data/stagingroot/craft3/vendor/yiisoft/yii2/views/errorHandler/callStackItem.php
2020-03-10 23:03:18 [-][14658][qqhpqgk2rlk8rce38eajjg2056][trace][yii\base\View::renderFile] Rendering view file: /data/stagingroot/craft3/vendor/yiisoft/yii2/views/errorHandler/callStackItem.php
2020-03-10 23:03:18 [-][14658][qqhpqgk2rlk8rce38eajjg2056][trace][yii\base\View::renderFile] Rendering view file: /data/stagingroot/craft3/vendor/yiisoft/yii2/views/errorHandler/callStackItem.php
2020-03-10 23:03:17 [-][14658][qqhpqgk2rlk8rce38eajjg2056][info][application] $_GET = [
'p' => 'admin/settings/plugins'
]

Allow multiple countries to redirect to the same site

We have a multi-site setup where each site represents a language/location.

Currently, we can set up our redirectMap with rules for each site.

What we want to do is add some additional settings for countries that aren't set up yet (or never will be) and redirect them to another site (one that already has its own redirect set).

Example:

'redirectMap' => [
    'de_ch' => [
        'country' => 'ch',
    ],
    'de_de' => [
        'country' => ['de', 'at']
    ],
    'us' => [
        'country' => 'us'
    ],
    'global' => '*'
]

Here, we'd want any user whose country is in de or at to be directed to our de_de site.

This might not account for more complex combinations of detection settings that some users may require, but would at least allow us to have a bit more control.

When assigned countries to the redirectMap they must be lower case otherwise the redirects won't work

When creating redirectMap I copied country codes from a third party and they were uppercase. However I discovered none of the redirects were working. So I looked through your code (redirectService.php line 208) where you set lowercase of the strtolower($countryInfo->country->isoCode) however you don't set lowercase of any of the values in the $criteriaVal.

Your documentation does show the country codes as lowercase however is never specified to be so.

Suggestion would be to force all comparisons to be lowercase and or add in your documentation that lowercase is expected.

Error when using 'redirectMapSimpleModeKey' => 'language',

Config:

<?php

return [
    '*' => [
        'autoRedirectEnabled' => true,

        'redirectMapSimpleModeKey' => 'language',
        
        'redirectMap' => [
            'siteHandleDe' => [
                'language' => 'de',
            ],
            'siteHandleFr' => [
                'language' => 'fr',
            ],
        ]
    ],
];

Using this config, I get the following error:

vaersaagod\geomate\services\RedirectService::getSiteFromInfoAndMap(): Argument #1 ($countryInfo) must be of type GeoIp2\Model\City|GeoIp2\Model\Country, null given, called in /Users/username/Web Projects/blp/vendor/vaersaagod/geomate/src/services/RedirectService.php on line 99

Since my redirectMapSimpleModeKey is set to language I do not get why the error calls for a country. What am I missing?

Craft CMS 4.2.7
GeoMate 2.0.0
PHP 8.0.8

Errors produced when forceIp set in geomete.php

I've installed geomete by following the instructions provided. As I'm working locally I've set my forceIp to my local IP address as follows:

return [ 'forceIp' => 'IP-ADDRESS-HERE' ];

When I add the following to my twig template {{ craft.geomate.country }} and run it I receive the following error:

PHP Recoverable Error – yii\base\ErrorException
Object of class GeoIp2\Model\Country could not be converted to string

Any advise on how to sort this would be greatly appreciated.

Configuration is not working

This is my config code:
`<?php
/**

  • GeoMate plugin Configuration

*/

return [
/**

  • cacheEnabled [bool]
  • Default: true
  • Enables or disables caching of IP data.
    /
    'cacheEnabled' => true,
    'redirectMapSimpleModeKey' => 'country',
    //'redirectMatchingElementOnly' => true,
    //'redirectIgnoreAdmins' => false,
    //'cityDbFilename' => "GeoLite2-City.mmdb",
    //'
    ' => [
    'autoRedirectEnabled' => true,
    'redirectMap' => [
    'nl' => ['nl','NL'],
    'uk' => ['uk','UK'],
    'sg' => ['sg','SG'],
    'au' => ['au','AU'],
    'fr' => ['fr','FR'],
    'de' => ['de','DE'],
    'jp' => ['jp','JP'],
    'default' => '*'
    ],
    //],
    'countryDbDownloadUrl' => 'My download url',
    'cityDbDownloadUrl' => 'My download url',
    'useSeparateLogfile' => true,
    'logLevel' => \yii\log\Logger::LEVEL_INFO
    ];
    Is not working for auto redirect, Andcraft.geomate.countryCode()output 'US',Butcraft.geomate.countryCode('My IP')is right. Alsocraft.geomate.redirectInformation()` is not working too.
    Am I coding wrong? I really need help, Please.

Should Geomate read and redirect based on GeoMateRedirectOverride cookie?

More of a question asking about the default or recommended behaviour.

I've got a site switcher that makes use of the addOverrideParam and this sets the GeoMateRedirectOverride cookie with value. If a user was to visit the site again (before the cookie expired) should they automatically be directed to what's set in the cookie?

Does GeoMate handle this or should this be done via a regular direct in the index template?

Thanks.

addOverrideParam does funny things

Hi,
Since 1.3.1, using | addOverrideParam behaves a bit unexpectedly:

{{ '/anyold_string/' | addOverrideParam }}  -> /anyold_string/?__region=✪

But on https://domain.com/site/path

{{ craft.app.request.pathInfo | addOverrideParam }} -> https://domain.com/site/https://domain.com/site/path?__region=✪

Whereas previously it returned

{{ craft.app.request.pathInfo | addOverrideParam }} -> path?__region=✪

given that

{{ craft.app.request.pathInfo }} -> path

For context, I'm using pathInfo in the navigation rather than craft.geomate.getSiteLinks() so i can send visitors directly to the same page on the alternate site by just replacing the site slug, but if there is a better way to do that, please let me know!

Retrieve list of all countries in database

How do we fetch a list of all the countries in the database, and their values like country codes?

Two reasons...

  1. For the mapping we need to know what the country codes are to map to our sites.

  2. We actually have a contact form where a user chooses their country. I would like that country automatically chosen. So the country list needs to be all the countries in the database.

So how can we get this list?

Thanks!

Issue with redirectMap configuration on multi-site setup

Hello!

Having an issue using the redirectMap configuration with a multi-site setup that has the following structure:

Group 1:

  • website.com
  • website.com/fi
  • website.com/sv

Group 2:

  • website-com.test
  • website-com.test/fi
  • website-com.test/sv

etc, goes up to 4 different groups.

I want the automatic redirect to work so that if I visit website.com from Finland I get redirected to website.com/fi, and same thing for each group. Right now however, it seems to work so that if I visit website-com.test from Finland, I get redirected to Group 1's website.com/fi site (assuming because Group 1's website is first in the mapping array).
The documentation didn't seem to include examples of how to configure a multi-site setup like this, but only covered how to do single language/country to site mappings.

This seems to be doable on the template level with some conditionals, but is it possible to do in a more simple way through the config file?

GeoMate 1.2.1
Craft 3.5.16

br,

Joel

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.