Multisite is coming to Craft 3, so this only applies to v2 See here
I don't think there is an integrated way to do this and it might be worth reading this post:
Are there any intentions to release multisite support for Craft?
..we're pretty against adding it to Craft... at least in the way EE did it, where everything is stored on a per-site basis.
That said, I guess you could do this with symbolic links if you wanted, this is untested but in theory it should/could work...
Say you have these folders on your website:
- craftinstall
- product
- brand
You could do ln -s /path/to/craftinstall/public /path/to/product/public and then repeat that for the brand, this will then mean both the public folders for your websites will point to the craftinstall/public folder and should then be able to pick up the craft folder.
In your general.php config file you could have these settings:
// Fetch url scheme
define('URI_SCHEME', ( isset($_SERVER['HTTPS'] ) ) ? "https://" : "http://" );
// Fetch current environment url
define('SITE_URL', URI_SCHEME . $_SERVER['SERVER_NAME'] . '/');
define('BASEPATH', realpath(CRAFT_BASE_PATH . '/../') . '/');
return array(
// These are common (default) to all
'*' => array(
'environmentVariables' => array(
'basePath' => BASEPATH,
'siteUrl' => SITE_URL
)
);
This would mean that whatever the url is, i.e: www.brand.com will be set as the siteUrl so in your actual craft install, under general settings your site url will simply be {siteUrl} and this will get replaced (same with basePath)
Which would then mean both sites should then point to the same craft install, now for templates and routes, this might not work, but it might but you could do something like this:
Your templates folder structure:
And in public/index.php file something like:
define('CRAFT_TEMPLATES_PATH', "craft/templates/" . $_SERVER['SERVER_NAME']);
As I said, I haven't tried or tested this so it would be interesting if it did work, this is just my theory :)