We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36425
    • 49 Posts
    i have a multilanguage site.
    and in htaccess this work not correctly:

    RewriteRule ^(en|de)?/?(.*)$ index.php?cultureKey=$1&q=$2 [L,QSA]

    - on my homepages of every site i have a pagination with getPage&getresource
    so when i go: site.com/de/?page=2
    its redirect me to site.com/de/ - with NO ?page

    can some1 help?
      • 3749
      • 24,544 Posts
      What is your rewrite condition?


      ------------------------------------------------------------------------------------------
      PLEASE, PLEASE specify the version of MODX you are using.
      MODX info for everyone: http://bobsguides.com/modx.html
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 36425
        • 49 Posts
        do u mean this?

        # 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 ^(en|de)?/?(.*)$ index.php?cultureKey=$1&q=$2 [L,QSA]

        i use MODX Revolution 2.2.4-pl (traditional) [ed. note: gaserge last edited this post 14 years ago.]
          • 3749
          • 24,544 Posts
          Yes, your rewrite rule only applies to the filename part so you're ignoring the query. Try"

          RewriteCond %{REQUEST_URI} !-f 



          ------------------------------------------------------------------------------------------
          PLEASE, PLEASE specify the version of MODX you are using.
          MODX info for everyone: http://bobsguides.com/modx.html
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
            • 36425
            • 49 Posts
            not help(

            hmm.. but for example
            site.com/de/blog/?page=2 - is working, not work - only on start pages of contexts:
            query ignored only on
            site.com/de/?query=ignore and
            site.com/en/?query=ignnore

            and default context
            site.com/?query=NOTignore [ed. note: gaserge last edited this post 14 years ago.]
              • 3749
              • 24,544 Posts
              Do you have this tag in the head section of all templates?

              <base href="[[!++site_url]]" />


              You may, or may not, need the ! depending on your setup, try with that first.


              ------------------------------------------------------------------------------------------
              PLEASE, PLEASE specify the version of MODX you are using.
              MODX info for everyone: http://bobsguides.com/modx.html
                Did I help you? Buy me a beer
                Get my Book: MODX:The Official Guide
                MODX info for everyone: http://bobsguides.com/modx.html
                My MODX Extras
                Bob's Guides is now hosted at A2 MODX Hosting
                • 36425
                • 49 Posts
                yes)
                by testing and trying to find error i start to think that problem is not in htaccess
                ( i return all default setting modx ( to RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]) for ex.) and test the switch, and have same results on home pages )

                so. the problem may in plugin that switching context. i dont sort out yet, but testing and testing...
                code of plugin, that activate on handlerequest:
                if($modx->context->get('key') != "mgr"){
                        switch (  $_REQUEST['cultureKey'] ) {
                            case 'de':
                                $modx->switchContext('de');
                                break;
                            case 'en':
                                $modx->switchContext('en');
                                break;
                            default:
                                break;
                        }
                }


                if die(); in start/end of it, $_REQUEST have $_GET['page'] and all anouther GET...
                but after plugin this it deliting by something... maybe i need set some option for switching?
                  • 36425
                  • 49 Posts
                    • 36425
                    • 49 Posts
                    hmmm... i use this plugin before... on MODX Revolution 2.1.5-pl (traditional) - its work correct ( but on switching http_host ),

                    i think it double redirects then switching on homepage context;

                    do u know where can i see function "switchContext" in core?.. or maybe any ideas? [ed. note: gaserge last edited this post 14 years ago.]
                      • 36425
                      • 49 Posts
                      its realy have double redirect, i catch it by loging from plugin:
                      [2012-10-03 05:35:14] (ERROR @ /index.php) coming from /de/?page=2
                      [2012-10-03 05:35:14] (ERROR @ /index.php) coming from /de/


                      this redirect appear only for:
                      - not default context;
                      - only for site_start pages;
                      - AND for query with symb. after ? - ?page=1 for ex.
                      mysticism?

                      ohhhhh.... what next.. [ed. note: gaserge last edited this post 14 years ago.]