This plugin allows you redirect your users to the desired url based on user browser preferences
This plugin requires Craft CMS 4.0.0 or later
To install the plugin, follow these instructions.
-
Open your terminal and go to your Craft project:
cd /path/to/project
-
Then tell Composer to load the plugin:
composer require liquidbcn/craftcms-language-redirect
-
In the Control Panel, go to Settings → Plugins and click the “Install” button for this plugin.
You can configure the plugin creating a file under your config folder named language-redirect.php with the desired settings.
defaultLanguage: default locale if none is detected
urls: array containing the mapping between the locale and the relative url of your language base path
Example
<?php
return [
'defaultLanguage' => 'en-GB',
'urls' => [
'ca' => '/ca/',
'ca-ES' => '/ca/',
'es' => '/es/',
'es-ES' => '/es/',
'en-GB' => '/en/',
'en-US' => '/en/',
'en' => '/en/'
]
];
Brought to you by Liquid Studio