Configuration

You can change the way this extensions tries to redirect site visitors. The two options are

  • Browser language (HTTP headers)
  • IP address

IP address based redirects

First you need to fetch a database file and store it on your server. This file is mandatory as it is used to map IP addresses to countries.

  1. Update the GeoIP2 database file via CLI or Scheduler.

    • CLI

      Run ./vendor/bin/typo3 sitelanguageredirection:updatedb

    • Scheduler

      Create new task of class Execute console commands and set Schedulable Command to sitelanguageredirection:updatedb

      Settings of new scheduler task.

      Tip

      Use this option to periodically update your database file.

    This step creates a file under \TYPO3\CMS\Core\Core\Environment::getVarPath() . '/sitelanguageredirection/' with all the geolocation information.

    Note

    This does not alter your SQL database.

  2. Update the preferred method in your site configuration in the tab Site Language Redirection. Defaults to HTTP headers.

    Screenshot showing the Site Language Redirection tab in the site configuration.

    This updates config/sites/<sitename>/config.yaml and adds the following line of code:

    SiteLanguageRedirectionMethod: 2
    

Language Fallbacks

This feature adds the possibility to define fallback languages. So for instance, if there’s no italian version of the website, redirect to english version, and so on.

Site configuration would look like this with optional SiteLanguageRedirectionFallbacks:

SiteLanguageRedirectionFallbacks:
   fr: 'en'
   it: 'en'