I set up my multiple context environment using the switch-statement method described at
http://www.h-quadrat.com/techblog/111-modx-revolution-multi-domain-context-installation-english.php.
Initially I had just set up one additional context. It looks like this:
And my switch statement in index.php looked like this:
switch(strtolower(MODX_HTTP_HOST)) {
case 'dev.uwsa.edu:80':
case 'dev.uwsa.edu':
$modx->initialize('myuwsa');
break;
case 'wwwnew.uwsa.edu:80':
case 'wwwnew.uwsa.edu':
$modx->initialize('web');
break;
default:
// by default / if no other rule can be applied, load 'web' context
$modx->initialize('web');
break;
}
and everything worked just as it should. But last week I tried to add a third context, with these parameters:
I added a new section to the switch statement:
switch(strtolower(MODX_HTTP_HOST)) {
case 'dev.uwsa.edu:80':
case 'dev.uwsa.edu':
$modx->initialize('myuwsa');
break;
case 'itmc.wisconsin.edu:80':
case 'itmc.wisconsin.edu':
$modx->initialize('ITMC');
break;
case 'wwwnew.uwsa.edu:80':
case 'wwwnew.uwsa.edu':
$modx->initialize('web');
break;
default:
// by default / if no other rule can be applied, load 'web' context
$modx->initialize('web');
break;
}
I expected this to work, but it isn’t. When I request a page via
http://itmc.wisconsin.edu, the value of MODX_HTTP_HOST is still ’wwwnew.uwsa.edu’, even though I have an http_host key set up in the ITMC context. So only resources that exist in my web context will load via that hostname.
Is this a bug? Should I just whack this context and try again? Or am I doing something wrong with my configuration?