I tried following the tutorial on
http://www.belafontecode.com/modx-revolution-hosting-multiple-domains/. I have set everything up and it all worked fine (individual context's pages were showing). I undid this change as it wasnt ready for release yet, and having come back to it now I am finding switchcontext isnt working any more? What am I doing wrong?
I have changed the code in my index.php to take into consideration multiple contexts and switch based on http_host. However, no matter what I do it seem that the default context's webpages keep showing.
This is the code I inserted into index.php:
/* Setup context mapping */
switch ($modx->getOption('http_host')) {
case 'mytest.website.com:80':
case 'mytest.website.com':
// if the http_host is of a specific domain, switch the context
$modx->switchContext('mytest');
break;
default:
// fallback, go to main context
$modx->initialize('web');
break;
}
It would appear going to mytest.website.com works fine, however it loads the page from www.website.com!
It is almost as if the line
$modx->switchContext('mytest'); doesnt do anything, or as if the if statement falls through to default.
I have tried including the snippet on the homepage printing out what the http_host value holds, it appears to be correct even though the context itself is not switching.
Any help?