Subscribe: RSS
  • I have a redirect loop in my web pages with /en/ or /nl/ after the setup of babel, creating contexts and editing my .htaccess... i dont now why. can you please help me.?

    My modx project is in the wamp/www/ of my server (wamp server)

    RewriteEngine On
    RewriteBase /babelmodx/
    
    
    
    # Rewrite www.domain.com -> domain.com -- used with SEO Strict URLs plugin
    #RewriteCond %{HTTP_HOST} .
    #RewriteCond %{HTTP_HOST} !^localhost/babelmodx [NC]
    #RewriteRule (.*) http://localhost/babelmodx/$1 [R=301,L]





    i've also uncomment the 3 lasts lines but doesn't work ... sad




    # The Friendly URLs part
    # detect language when requesting the root (/)
    RewriteCond %{HTTP:Accept-Language} !^de [NC]
    RewriteRule ^$ en/ [R=301,L]
    RewriteRule ^$ de/ [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 ^(en|nl)/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 ^(en|nl)/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 ^(en|nl)?/?(.*)$ index.php?cultureKey=$1&q=$2 [L,QSA]




    My Babel Plugin :


    <?php
    if($modx->context->get('key') != "mgr")
    {
      /* grab the current langauge from the cultureKey request var */
      switch ($_REQUEST['cultureKey']) {
        case 'nl':
          /* switch the context */
          $modx->switchContext('nl');
          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']);
    }




    Sorry about my bad english and thanks you