Ok, I still need help with this - I may have posted in the wrong forum / or my post might have been previously unclear - will try again. It was here (
http://modxcms.com/forums/index.php/topic,65789.0.html ).
Have just upgraded from 2.1.1 and it’s still not working as expected. But, just this morning I made progress, so perhaps this might make the situation clearer.
I’ve got a site setup with three contexts - plus one for the default web context. I have 3 domains (these are aliases) going to three contexts - nothing is going to the default web context.
EG :
domain.com -> com context
domain.com.au -> au context
domain.co.nz -> nz context
Nothing goes to the default web context - we’re using that for documents / and page-not-found documents shared across the three domains (which does work quite well).
If I use the plugin from the wiki :
switch ($modx->getOption('http_host')) {
case 'domain.com':
$modx->switchContext('com');
break;
case 'domain.co.nz':
$modx->switchContext('nz');
break;
case 'domain.com.au':
$modx->switchContext('au');
break;
default:
break;
}
The front end displays perfectly. But if I login to the manager @ domain.com/manager (it fires the switchContext) and the manager gives me "Access Denied". The same for the other two domains. At this stage I’m effectively locked out of the manager - so have to go to the db and disable the plugin. Then we’re back in business.
So, I disabled the plugin - and edited the index.php to :
switch ($_SERVER["HTTP_HOST"]) {
case 'domain.com':
$modx->initialize('com');
break;
case 'domain.co.nz':
$modx->initialize('nz');
break;
case 'domain.com.au':
$modx->initialize('au');
break;
default:
$modx->initialize('web');
break;
}
And now both the manager and front-end work as expected. It doesn’t seem like you can use the manager when a ’switchContext’ has been fired... and obviously updating the index.php isn’t a very good solution. I’m sure that there’s something wrong... ? lol, help?