We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
  • I have used babel on multiple websites in the past, but this is the first one that I have tried using cloud. It only has two languages and uses the exact same .htaccess code as shown here:

    http://www.multilingual-modx.com/blog/2011/seo-friendly-multilingual-websites-with-modx-and-babel.html

    I think that the rewrite rules here do not work on cloud... can anyone confirm or deny this?

    Thanks,
    Ben
      Benjamin Davis: American web designer living in Munich, Germany and a MODX Ambassador. I am also co-founder of SEDA.digital, a MODX Agency.
    • Ok, I see now that cloud does not run on Apache and therefore will not read .htaccess... so I then went to a NGINX converter and got this as a result:

      location / { rewrite ^/$ /en/ redirect; rewrite ^/$ /de/ redirect; if (!-e $request_filename){ rewrite ^/(en|de)/assets(.*)$ /assets$2 break; } if (!-e $request_filename){ rewrite ^/(en|de)?/?(.*)$ /index.php?cultureKey=$1&q=$2 break; } }

      It doesn't seem to work. Any ideas?
        Benjamin Davis: American web designer living in Munich, Germany and a MODX Ambassador. I am also co-founder of SEDA.digital, a MODX Agency.
        • 18608
        • 112 Posts
        What is it that doesn't work for you? Is it the paths for the assets or switching the contexts?
          Mathias Dannevang | Webdesigner at dannevang.org | Tweets @dannevang
        • Well, the links to assets, all relative links, and switching contexts are not working.

          Here is the link
          http://liz-frey-relocation.bdcreative.modxcloud.com

          Since I applied the above mentioned code in cloud, it now exports a file to save...
            Benjamin Davis: American web designer living in Munich, Germany and a MODX Ambassador. I am also co-founder of SEDA.digital, a MODX Agency.
            • 18608
            • 112 Posts
            Could you undo the rewriterule for a moment, would love the see what code it generates
              Mathias Dannevang | Webdesigner at dannevang.org | Tweets @dannevang
            • Ok, I deleted the NGINX code.
                Benjamin Davis: American web designer living in Munich, Germany and a MODX Ambassador. I am also co-founder of SEDA.digital, a MODX Agency.
              • It just forwards to my home page with the wrong links written to all assets and links. The Babel plugin and gateway are at work here. I just need to know what rewrite rules I need to work with Babel.

                By the way, thanks for looking at that!
                  Benjamin Davis: American web designer living in Munich, Germany and a MODX Ambassador. I am also co-founder of SEDA.digital, a MODX Agency.
                • The Apache rules are:
                  # 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|de)/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)/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)?/?(.*)$ index.php?cultureKey=$1&q=$2 [L,QSA]
                    Benjamin Davis: American web designer living in Munich, Germany and a MODX Ambassador. I am also co-founder of SEDA.digital, a MODX Agency.
                    • 18608
                    • 112 Posts
                    A little test, could you try adding the following rule:

                    location /en {
                      rewrite ^/en/assets(.*)$ /assets$2 break;
                    }
                    
                    location /de {
                      rewrite ^/de/assets(.*)$ /assets$2 break;
                    }
                    
                    location / {
                      try_files $uri $uri/ @modx-rewrite;
                    }


                    And then we'll see if that solves the assets redirect.
                      Mathias Dannevang | Webdesigner at dannevang.org | Tweets @dannevang
                    • Thanks for this, Mathias,

                      I added the rule, but no change in the frontend. I also made a request to MODX for help. I will post what I find out from them. This would make for a great addition to the Babel docs. I'm sure that this will come up again...
                        Benjamin Davis: American web designer living in Munich, Germany and a MODX Ambassador. I am also co-founder of SEDA.digital, a MODX Agency.