Hello,
I’m trying to setup a multilingual website and i’ve got a problem with
FirstChildRedirect.
I’m using one context for each language:
fr and
en.
On each context, I’ve set up differents parameters. Here is the configuration for the “en” context:
base_url -> {base_url}en/
site_url -> {site_url}en/
cultureKey -> en
site_start -> 1
and the “fr” context :
base_url -> {base_url}fr/
site_url -> {site_url}fr/
cultureKey -> fr
site_start -> 2
Then, I’ve added the plugin available in this thread:
http://modxcms.com/forums/index.php/topic,51346.msg298387.html#msg298387
<?php
$pieces = explode('/', trim($_REQUEST[$modx->getOption('request_param_alias', null, 'q')], '/'), 2);
if (count($pieces) > 0) {
switch ($pieces[0]) {
case 'en':
if (isset($pieces[1])) {
$_REQUEST[$modx->getOption('request_param_alias', null, 'q')] = $pieces[1];
} else {
$_REQUEST[$modx->getOption('request_param_alias', null, 'q')] = '';
}
$modx->switchContext('en');
break;
case 'fr':
if (isset($pieces[1])) {
$_REQUEST[$modx->getOption('request_param_alias', null, 'q')] = $pieces[1];
} else {
$_REQUEST[$modx->getOption('request_param_alias', null, 'q')] = '';
}
$modx->switchContext('fr');
break;
default:
break;
}
}
?>
The plugin is loaded on the
OnHandleRequest event.
Finally, i’ve changed the index.php file in order to load the “fr” context by default:
Everything is working fine, except for the FirstChildRedirect snippet which isn’t working.
Each parent document is associated with a template with the following code:
[[!FirstChildRedirect? &sortDir=`ASC`]]
When i’m clicking on a parent document, the browser returns me a 310 error:
Erreur 310 (net::ERR_TOO_MANY_REDIRECTS)
Is there something that i’m missing ? What should i do ?
On the whole, is the entire configuration ok ?
My server: MODx Revo 2.0.4, PHP 5.3.3, MySQL 5.1.39-1
Thanks in advance.