my website is multilingual and runs with Babel. I have also created a gateway plugin for this, set the contexts and made entries in htaccess as it says in the tutorial.
The problem is: as soon as I use e.g. the letters “fr” > “fragen.html” in the alias, my content switches to “french”.
Unfortunately I can’t find the source of the error.
MODx 2.8.3
PHP: 7.3
gateway:
<?php
if($modx->context->get('key') != "mgr"){
switch ($_REQUEST['cultureKey']) {
default:
$modx->switchContext('web');
break;
case 'en':
$modx->switchContext('en');
break;
case 'fr':
$modx->switchContext('fr');
break;
case 'sp':
$modx->switchContext('sp');
break;
}
unset($_GET['cultureKey']);
}
The problem is, that in this rule the slash in the url is optional: /?
When you request the url “fragen.html”, that gets converted to index.php?cultureKey=fr&q=agen.html.
You probably need different rules to make it work. Maybe something like this:
The rule RewriteRule ^(.*)$ index.php?q=$1 [L,QSA] may create a PHP warning in the gateway plugin ($_REQUEST['cultureKey']), because the parameter cultureKey is not set.
Maybe you have to adjust the plugin code or change the rule to
This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.