We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
  • I can't reproduce this situation right now to help you,
    may I know if you have access to apache error log?
      TilliLab | MODX Ambassador
      website
      • 41958
      • 65 Posts
      Hello phacer!

      Do you also have modx in a sub/sub folder like I have? http://mydomain.com/sub/modx/ ?
      Did you manage to make it work?
        • 41958
        • 65 Posts
        tililab: I do not have access to apache log, hm what to do?
          • 41958
          • 65 Posts
          Hi all! SOLVED

          I changed something in my .htaccess in modx root
          #this is the new one
          RewriteRule ^(en|hu)?/?(.*)$ index.php?cultureKey=$1 [L,QSA]
          #this is the old one
          #RewriteRule ^(en|hu)?/?(.*)$ index.php?cultureKey=$1&q=$2 [L,QSA]

          I just removed the &q=$2 part from the end.

          Actually I have no idea what this means: &q=$2
          Anyone knows?

          Let me know if it works for you also.
            • 39583
            • 103 Posts
            Yup, same problem as you.

            I tried your solution two days ago and for me i could never get past the start page of each language. If I tried a sub-page I got back to the front.

            I think "q" is for the call of the page you want to visit.

            So for me it remains the same! sad

            P.S.
            Sorry Tillilab, I dont have access to the apache error log.
              --
              André
              • 41958
              • 65 Posts
              phacer,
              for me it seems to be working ok, although I only have 2 peges/language and a navigation menu.
                • 41958
                • 65 Posts
                Hi again,

                maybe not the best place to ask but now that I know a few things about modx what would be the best route to take in building a site?
                Shuld I just install one of the sample sites or build my own? Also what happens if I built a few pages then decide to install a smaple site? My previous pages gets messed up or what? Also if later I delete the sample....? And and and... many questions and would be nice to hear how others do it?
                Thx
                  • 37005
                  • 3 Posts
                  Had the same problem and removing this: &q=$2 as openstep wrote solved it! thanks!
                    • 42460
                    • 1 Posts
                    Hi

                    Firstly thank you every one on the thread for sharing your ideas, it helped a lot.

                    I too got stuck in the same issue and had a chance to do some study to solve the issue.

                    The below code is working fine for for a sub folder setup of my modx project:

                    MOdx Version: 2.2.6-pl

                    Babel Version: 2.2.5-pl

                    gateway plugin:

                    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('web');
                                            break;
                                        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 code replacement for friendly URLs

                    # redirect all requests to /en/favicon.ico and /de/favicon.ico
                    # to /favicon.ico
                    RewriteCond %{REQUEST_FILENAME} !-d
                    RewriteCond %{REQUEST_FILENAME} !-f
                    RewriteRule ^(en|de|fr)/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|de|fr)/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|de|fr)?/?/(.+)$ index.php?cultureKey=$1&q=$2 [L,QSA]
                    RewriteRule ^(en|de|fr)?/?$ index.php?cultureKey=$1 [L,QSA]


                    Hope this helps.

                    Cheers
                      • 41958
                      • 65 Posts
                      Hi,

                      thanks also for posting.
                      It seems now I can access sites like domain/folder/modx/contact.html for example but domain/folder/en/ does not work, it only works if I target individual pages. What could be wrong?

                      Do you also have modx in a sub/sub folder like I have? http://mydomain.com/sub/modx/ ?

                      Here is my .htaccess


                      RewriteEngine On
                      RewriteBase /munkak/modx/

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


                      # The Friendly URLs part
                      # redirect all requests to /en/favicon.ico
                      # to /favicon.ico
                      RewriteCond %{REQUEST_FILENAME} !-d
                      RewriteCond %{REQUEST_FILENAME} !-f
                      RewriteRule ^(en|hu)/favicon.ico$ favicon.ico [L,QSA]

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

                      # redirect all other requests to /en/*
                      # to index.php and set the cultureKey parameter
                      RewriteCond %{REQUEST_FILENAME} !-f
                      RewriteCond %{REQUEST_FILENAME} !-d
                      #RewriteRule ^(en|hu)?/?(.*)$ index.php?cultureKey=$1 [L,QSA]
                      RewriteRule ^(en|hu)?/?(.+)$ index.php?cultureKey=$1&q=$2 [L,QSA]
                      RewriteRule ^(en|hu)?/?$ index.php?cultureKey=$1 [L,QSA]
                      #RewriteRule ^(en|hu)?/?(.*)$ index.php?cultureKey=$1&q=$2 [L,QSA]

                      and my gateway plugin
                      <?php
                      if($modx->context->get('key') != "mgr"){
                      /* grab the current langauge from the cultureKey request var */
                      switch ($_REQUEST['cultureKey']) {
                      case 'hu':
                      /* switch the context */
                      $modx->switchContext('Magyar');
                      break;
                      case 'en':
                      /* switch the context */
                      $modx->switchContext('web');
                      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']);
                      }
                      ?>
                      can you post screenshot of how it is set up in the manager under friendly url ?
                      [ed. note: openstep last edited this post 11 years, 3 months ago.]