I am in stage of moving one of existing sites to modx. I plan to use one modx installation for a couple of non-related websites.
Websites are on a shared-linux hosting.
- MODx Revolution 2.0.3-pl version (Upgraded to MODx Revolution 2.0.4-pl2 now, just in case it might help but no difference)
- I forwarded the first website document root to modx installation folder.
- Created a new web context, and move all documents from "web" to "new context"
- Added the following settings for "new context"
--- base_url --> /
--- http_host --> www.newwebsite.com
--- site_start --> 117
--- site_url -->
http://www.newwebsite.com/
- created a plugin with following code, and activated "OnHandleRequest" event
<?php
switch ($modx->getOption('http_host')) {
case 'www.newwebsite.com:80':
case 'www.newwebsite.com':
// if the http_host is of a specific domain, switch the context
$modx->switchContext('newcontext');
break;
default:
// by default, don't do anything
break;
}
- htaccess file is below
Options +FollowSymlinks
RewriteEngine On
RewriteBase /modx
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /modx/index.php?q=$1 [L,QSA]
- friendly url’s are active
If I browse the home page, as www.newwebsite.com I can see the content, (with some snippets not working).
If I browse on any other page, "Internal Server Error" error is displayed.
If I remove the friendly url’s , then website works without any problem.
Do we need to set anything else to make modx work for multiple sites with friendly urls and one gateway plugin.
Thanks