We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 49846
    • 22 Posts
    Hello,

    I have one modx installation and have created three different contexts - web, contexta, contextb - each in their separate folders. I have installed Babel and created the necessary contexts (I want a bilingual site: en and zh) for each of the separate sites.


    • I have a gateway plugin to switch contexts for the different languages: en and zh.
    • In my root index.php I have a modx->getOption('http_host') to switch between the different contexts (contexta and contextb) with default set to web.
    • I have created a sub domain via virtualmin on the server
    • I have also configured the dns on the server

    The issue I am having is: when I clear my cache folder, and reload the contexta homepage - it loads. But then when I refresh the page etc., I get the 503 error - 404 page not found. When I clear the cache again, the page loads. I know the URL is pointing to the server because I have added a test.html file, and that loads.

    I have looked into the cache folder and realised that when the "includes" folder is there, my page will show an 503 error. The "includes" folder has my modplugins... my guess is it might be the babel plugin causing the problem??

    In my .htaccess in the root, I have:
     
    RewriteEngine On
    RewriteBase /
    
    RewriteCond $1 !^frontlinetouch/
    RewriteCond %{HTTP_HOST} ^www\.frontlinetouch.pagecomingsoon\.co.uk
    RewriteRule (.*) /frontlinetouch/$1 [L]
    
    # The Friendly URLs part
    # redirect all requests to /de/favicon.ico and /nl/favicon.ico
    # to /favicon.ico
    #RewriteCond %{HTTP_HOST} ^www\.frontline.pagecomingsoon\.co.uk
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(en|zh)/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 ^(en|zh)/assets(.*)$ assets$2 [L,QSA]
    						 
    # 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|zh)?/?(.*)$ index.php?cultureKey=$1&q=$2 [L,QSA]
    


    In my .htaccess for contexta, I have:

    RewriteEngine On
    RewriteBase /
    
    # Redirect non-www urls to www
    #RewriteEngine on
    RewriteCond %{HTTP_HOST} ^frontlinetouch.pagecomingsoon\.co.uk [NC]
    RewriteRule (.*) http://www.frontlinetouch.pagecomingsoon.co.uk/$1 [R=301,L]
    

    This question has been answered by b0b0b0. See the first response.

    [ed. note: b0b0b0 last edited this post 11 years, 5 months ago.]
    • discuss.answer
      • 49846
      • 22 Posts
      So, I've finally managed to solve this - sub domains and their bilingual sites are loading.

      I initially had a gateaway plugin to switch contexts between the different culture keys. This was very nooby of me as this was obviously just directed at the root, and produced error when the culture key was matched for the subdomains. So, I copied the gateaway plugin from http://designfromwithin.com/blog/modx-multilingual into each of the separate domain's index.php file. So for each separate context/domain, it will check the culture key and change context accordingly. After I did this, I came across a blank page when redirecting to the site with the added culture key i.e. frontlinetouch.pagecomingsoon.co.uk/zh/. This was resolved by changing the rewrite base from /frontlinetouch/ back to just /

      Sorry if this was poorly explained. If anyone comes across the same problem I had, I will be happy to elaborate more on what I did.