The environment.php file included in BigTree 4.2.12 and higher contains an example of a multi-domain configuration:

$bigtree["config"]["sites"] = array(
	"primary" => array(
		"trunk" => 0,
		"domain" => "http://primary.bigtree.dev",
		"www_root" => "http://primary.bigtree.dev/",
		"static_root" => "http://primary.bigtree.dev/"
	),
	"alt" => array(
		"trunk" => 7,
		"domain" => "http://alt.bigtree.dev",
		"www_root" => "http://alt.bigtree.dev/",
		"static_root" => "http://alt.bigtree.dev/"
	)
);

When the $bigtree["config"]["sites"] array is not empty, BigTree is instructed to run in a multi-domain configuration. Each array inside of the "sites" array contains a key (which will be referred to through this documentation as the site key) for each array of domain data. Inside the domain data array are the following key/value pairs:

  • "trunk" — The ID of the page that acts as the root page for the domain (the homepage of the domain)
  • "domain", "www_root", and "static_root" are equivalent to their normal environment.php equivalents

Behavioral Changes

When running in a multi-domain setup, you will still only have a single admin root -- you will want to visit the primary admin URL. Logging into that URL, however, will set cookies for all the domains in your multi-domain setup so that your BigTree bar works for all the domains.

When visiting a URL that should be assigned to an alternate domain from the root domain you will automatically 301 redirect to the alternate domain. For instance, if /alt/ refers to alt.bigtree.dev and you visit http://primary.bigtree.dev/alt/test-page/ it will automatically redirect you to http://alt.bigtree.dev/test-page/. The same principle applies to page links in the CMS. They should automatically update to the desired domain.