Last active
February 18, 2019 12:33
-
-
Save bartholomej/ef0ccdfd9333fb0aef50 to your computer and use it in GitHub Desktop.
MODx htaccess for Babel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# MODX htaccess for BABEL (idealab settings) | |
RewriteEngine On | |
RewriteBase / | |
php_flag display_startup_errors on | |
php_flag display_errors on | |
php_flag html_errors on | |
# redirect all requests to /de/favicon.ico and /nl/favicon.ico | |
# to /favicon.ico | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteRule ^(web|en)/favicon.ico$ favicon.ico [L,QSA] | |
# redirect all requests to /de/assets* and /nl/assets* to /assets* | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteRule ^(web|en)/assets(.*)$ assets$2 [L,QSA] | |
# redirect all other requests to /de/* and /nl/* | |
# to index.php and set the cultureKey parameter | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule ^(web|en)?/?(.*)$ index.php?cultureKey=$1&q=$2 [L,QSA] | |
php_flag zlib.output_compression On | |
php_value zlib.output_compression_level 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if($modx->context->get('key') != "mgr"){ | |
/* grab the current langauge from the cultureKey request var */ | |
switch ($_REQUEST['cultureKey']) { | |
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']); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, is this htaccess example are right for the new htaccess file from modx 2.6.X ?
https://github.com/modxcms/revolution/blob/2.x/ht.access
Which part of the code we need to comment/uncomment ?