if($modx->context->get('key') != "mgr"){
/* grab the current langauge from the cultureKey request var */
switch ($_REQUEST['cultureKey']) {
case 'de':
/* switch the context */
$modx->switchContext('de');
break;
case 'en':
/* switch the context */
$modx->switchContext('en');
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']);
}RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^www\.website\.eu [NC]
RewriteRule (.*) http://www.website.eu/$1 [R=301,L]
# The Friendly URLs part
# detect language when requesting the root (/)
RewriteCond %{HTTP:Accept-Language} !^(de|en) [NC]
RewriteRule ^$ nl/ [R=301,L]
RewriteRule ^$ de/ [R=301,L]
RewriteRule ^$ en/ [R=301,L]
# redirect all requests to /en/favicon.ico and /de/favicon.ico
# to /favicon.ico
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(nl|de|en)/favicon.ico$ favicon.ico [L,QSA]
# redirect all requests to /en/assets* and /de/assets* to /assets*
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(nl|de|en)/assets(.*)$ assets$2 [L,QSA]
# redirect all other requests to /en/* and /de/*
# to index.php and set the cultureKey parameter
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(nl|de|en)?/?(.*)$ index.php?cultureKey=$1&q=$2 [L,QSA]
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript
# The Friendly URLs part
# detect language when requesting the root (/)
RewriteCond %{HTTP:Accept-Language} !^(de|en) [NC]
RewriteRule ^$ nl/ [R=301,L]