Skip to content

Instantly share code, notes, and snippets.

@mkay
Created January 22, 2014 09:52
Show Gist options
  • Save mkay/8556130 to your computer and use it in GitHub Desktop.
Save mkay/8556130 to your computer and use it in GitHub Desktop.
Example switch for handling multiple websites with MODX. In your /index.php: search & replace (+/- line 68)... $modx->initialize('web'); ...with this gist:
// $modx->initialize('web');
switch(strtolower(MODX_HTTP_HOST)) {
case 'www.example.com:80':
case 'www.example.com':
$modx->initialize('my-example-context'); // context for example.com
break;
case 'www.example2.com:80':
case 'www.example2.com':
$modx->initialize('my-example2-context'); // context for example2.com
break;
default:
$modx->initialize('web'); // default context
break;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment