Skip to content

Multiple Sites from a Single Install

zuha edited this page May 15, 2012 · 12 revisions

How to use the sites directory...

The sites directory contains individual sites which use the same install as an extension of the "app" folder. This makes it possible to keep all common functionality in one place across 100's of sites, and yet customize to the smallest of levels without effecting any other site on that install. This works by over writing existing functionality by creating new versions with the same file names, within individual site directories. Or alternatively creating new functionality which is only available to that individual site.

Step one to any use of the sites directory is to edit sites/bootstrap.php to contain the domain, and which sites sub directory that domain should point to in this format.

$domains['{ACTUAL URL IN BROWSER ADDRESS BAR}'] = '{FOLDER NAME IN /SITES}';

For example, if you want mydomain.com to point to the sites/mydomain.com folder you would have this...

$domains['mydomain.com'] = 'mydomain.com';

...in the sites/bootstrap.php folder. Same goes for any other version of that domain or sub domain. For example if you have multiple domains, subdomains, and host multiple sites your sites/bootstrap.php file might contain settings that look like this...

// Site 1
$domains['mydomain.com'] = 'mydomain.com';
$domains['www.mydomain.com'] = 'mydomain.com';
$domains['my-back-up-domain.com'] = 'mydomain.com';
// Site 2
$domains['some-example.com'] = 'some-exmple-folder';
$domains['www.another-example.com'] = 'some-exmple-folder';

Further Reading