We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 40237
    • 1 Posts
    Hello,
    I've stuck with strange problem.
    I have simple site with installed plugin babel for 5 langs.
    for main context (web) is set polish (pl) and if i want to show home page for this context

    http://modx.jobmaster.com.pl/pl/

    i've got 403 error, rest of pages show corectly.
    For translation's home pages also work corectly.
    please help me find solution.

    ----------------------------
    gateway plugin:
    <?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;
    case 'pl':
    /* switch the context */
    $modx->switchContext('web');
    break;
    case 'ru':
    /* switch the context */
    $modx->switchContext('ru');
    break;
    case 'hu':
    /* switch the context */
    $modx->switchContext('hu');
    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']);

    }

    ---------------------
    httacces file:
    RewriteEngine On
    RewriteBase /



    # Rewrite www.domain.com -> domain.com -- used with SEO Strict URLs plugin
    #RewriteCond %{HTTP_HOST} .
    #RewriteCond %{HTTP_HOST} !^modx.jobmaster\.com.pl [NC]
    #RewriteRule (.*) http://modx.jobmaster.com.pl/$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]

    # detect language when requesting the root (/)
    # RewriteCond %{HTTP:Accept-Language} !^(pl|en|ru|hu|de) [NC]
    # RewriteRule ^$ en/ [R=301,L]
    # RewriteRule ^$ ru/ [R=301,L]
    # RewriteRule ^$ hu/ [R=301,L]
    # RewriteRule ^$ de/ [R=301,L]


    # redirect all requests to /de/favicon.ico and /nl/favicon.ico
    # to /favicon.ico
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(pl|en|ru|hu|de)/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 ^(pl|en|ru|hu|de)/assets(.*)$ assets$2 [L,QSA]

    # redirect all requests to /de/assets* and /nl/assets* to /assets*
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(pl|en|ru|hu|de)/img(.*)$ img$2 [L,QSA]

    # redirect all requests to /de/assets* and /nl/assets* to /assets*
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(pl|en|ru|hu|de)/images(.*)$ images$2 [L,QSA]

    # redirect all requests to /de/assets* and /nl/assets* to /assets*
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(pl|en|ru|hu|de)?/?docs(.*)$ docs$2 [L,QSA]

    # redirect all requests to /de/assets* and /nl/assets* to /assets*
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(pl|en|ru|hu|de)/css(.*)$ css$2 [L,QSA]

    # tak wyglada link: http://modx.jobmaster.com.pl/pl/index.php?id=7
    # 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 ^(pl|en|ru|hu|de)?/?(.*)$ index.php?cultureKey=$1&q=$2 [L,QSA]