We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
  • Quote from: rachelmarama1 at Dec 01, 2011, 04:43 PM
    I have this working successfully on two other sites that I have, however, they are not using 2.1.3 (one is 2.0.8 and the other 2.1.2).
    ...
    Both sites currently go to the web context, but if i just use this line: $modx->initialize('web'); and change it to $modx->initialize('venus');
    then I am able to get to the venus context.
    I had some trouble with multiple domains, too, but it finaly worked very well. I remember that there was something about the system settings. Jay Gilmore came up with the right hint: Look at the settings you made for each context (host, paths, etc.) and make sure that those are also applied to the "web" context. As I said, I don't remember the circumstances to well, but this solved some of my problems with multidomain setups.
      MINDEFFECTS – DESIGN for PRINT, WEB and MEDIA
      http://twitter.com/mindeffects · http://www.facebook.com/mindeffects · http://www.youtube.com/mindeffects/ · skype://mindeffects_oliver
      • 4955
      • 32 Posts
      first i followed the instructions to multi language setup here:
      http://www.multilingual-modx.com/blog/2011/seo-friendly-multilingual-websites-with-modx-and-babel.html

      then i pointed two domains to the same httpdocs directory, changed the index:
      /* setup for multiple domains */
      switch(strtolower(MODX_HTTP_HOST)) {
         case 'www.1.eu':
            // if the http_host is modx-templates.com, switch the context to web
            $modx->initialize('web');
            break;
         case 'www.2.eu':
            // if the http_host is modx-templates.com, switch the context to web
            $modx->initialize('2-de');
            break;
        default:
            // by default / if no other rule can be applied, load 'web' context
            $modx->initialize('web');
            break;
      }


      This seems being ignored, overwritten by the gateway plugin. The gateway plugin modification is in my previous post.

      the context settings for X
      http_host: www.x.eu/de/ or www.x.eu/en/
      site_url: http://www.x.eu/de/ or http://www.x.eu/en/
      base_url: /de/ or /en/
      cultureKey: de or en
      site_start: resp. ID
      error_page: resp. ID
      site_name: wse


      i still have problems with is the site_status of www.2.eu. if i switch it off i can't use preview. the site stays locked. also i did not use separate directories for config.ore.php, htaccess and index.php. btw my htaccess:

      
      RewriteEngine On
      RewriteBase /
      
      
      # FORCE WWW ON ALL URLs
      RewriteCond %{HTTP_HOST} !^www\.
      RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
      
      # The Friendly URLs part
      # detect language when requesting the root (/)
      RewriteCond %{HTTP:Accept-Language} !^de [NC]
      RewriteRule ^$ de/ [R=301,L]
       
      # redirect all requests to /en/assets* and /de/assets* to /assets*
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteRule ^(de|en)/assets(.*)$ assets$2 [L,QSA]
      
      # redirect all requests to /en/1* and /de/1* to /1*
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteRule ^(de|en)/1(.*)$ etalon$2 [L,QSA]
      
      # redirect all requests to /en/2* and /de/2* to /2*
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteRule ^(de|en)/2(.*)$ 2$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 ^(de|en)?/?(.*)$ index.php?cultureKey=$1&q=$2 [L,QSA]
      


      This setup seems to be proofed for two domains each with en and de. more has to be shown wink [ed. note: charismeki last edited this post 11 years, 3 months ago.]
      • You need to choose a method of routing to the context: either using a plugin like ContextGateway or ContextRouter, OR editing the index.php. You cannot use both methods...
          • 4955
          • 32 Posts
          ah ok, didn't know that. though i am using the gateway plugin and this way it seems to work very fine.