Hello,
I'm currently setting up a modx multilingual with modx.
Everything is working fine except that a specific context like /fr/ keep linking to all / resources.
Exemple
http://aikidomontreux.com/fr/horizontal-menu/aikido/
click on aikido and you will be redirected to
http://aikidomontreux.com/horizontal-menu/aikido/
instead of :
http://aikidomontreux.com/fr/horizontal-menu/aikido/
Here is my config :
modx : MODX Revolution 2.2.6-pl (traditional)
babel 2.2.5
gateway plugin :
<?php
if($modx->context->get('key') != "mgr"){
/* grab the current langauge from the cultureKey request var */
switch ($_REQUEST['cultureKey']) {
case 'fr':
/* switch the context */
$modx->switchContext('fr');
break;
case 'de':
/* switch the context */
$modx->switchContext('de');
break;
default:
/* Set the default context here */
$modx->switchContext('web');
break;
}
/* unset GET var to avoid
* appending cultureKey=xy to URLs by other components */
unset($_GET['cultureKey']);
}
.htaccess :
RewriteEngine On
RewriteBase /
# Rewrite www.domain.com -> domain.com -- used with SEO Strict URLs plugin
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^aikidomontreux\.com [NC]
RewriteRule (.*) http://aikidomontreux.com/$1 [R=301,L]
#
# or for the opposite domain.com -> www.domain.com use the following
# DO NOT USE BOTH
#
#RewriteCond %{HTTP_HOST} .
#RewriteCond %{HTTP_HOST} !^www\.example-domain-please-change\.com [NC]
#RewriteRule (.*) http://www.example-domain-please-change.com/$1 [R=301,L]
# Rewrite secure requests properly to prevent SSL cert warnings, e.g. prevent
# https://www.domain.com when your cert only allows https://secure.domain.com
#RewriteCond %{SERVER_PORT} !^443
#RewriteRule (.*) https://example-domain-please-change.com/$1 [R=301,L]
# redirect all requests to /de/favicon.ico and /fr/favicon.ico
# to /favicon.ico
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(en|fr|de)/favicon.ico$ favicon.ico [L,QSA]
# redirect all requests to /de/assets* and /fr/assets* to /assets*
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(en|fr|de)/assets(.*)$ assets$2 [L,QSA]
# redirect all other requests to /de/* and /fr/*
# to index.php and set the cultureKey parameter
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(en|fr|de)?/?(.*)$ index.php?cultureKey=$1&q=$2 [L,QSA]
contexts :
web
base url : /
culture key : en
site url :
http://aikidomontreux.com/
fr
base url : /fr/
culture key : fr
site url :
http://aikidomontreux.com/fr/
de
base url : /de/
culture key : de
site url :
http://aikidomontreux.com/de/