<p>The approach you described is interesting and should actually work. Separate root folders would allow you to define the template folders individually (→ see <a href="https://craftcms.stackexchange.com/a/4739/125">Ben's answer</a> on how to set this up), but it looks like that's not what you need and your subdomains are more part of one and the same site.</p>

<p>Even with multiple root and template folders you could still include shared template partials, but sharing CSS, JS and assets would be troublesome. But, then again, more easy to have these individually for each subdomain.</p>

CC BY-SA 3.0
2015-05-15T21:20:22.823Z
I'm just not sure the best approach to take and that was the first that came to mind. Sharing css/js/assets would be troublesome just with multiple root and shared templates?
mmc501
CC BY-SA 3.0
2015-05-15T21:24:14.187Z
Say for the news feed if assets are added to an article they would need to be accessible from all domains. Articles would need to appear on the subdomains but all would appear on the main site. Would I be better setting those up as separate channels or just the 1 and use categories to specify what site it is for? Suppose if an article needs to appear on 2 sub domains it would need to be 1 channel?
mmc501
CC BY-SA 3.0
2015-05-15T21:54:02.250Z
Ok, this now reads even more like your subdomains are just subpages and you're more interested in sharing things than separating them, which all speaks for the one root folder idea. You can have shared CSS, JS and assets above the root, so no problems on that front (relative, root relative or absolute using your multi-env `siteUrl` variable).
carlcs
CC BY-SA 3.0
2015-05-15T22:02:02.220Z
You can join channels in a template easily via `craft.entries.section('news1, news2')`, so I'd probably rather decide on how you want the content to be structured in the CP, what makes the most sense from the data entry and also the CP index views. With separate channels you're stuck with separate index views, with one channel and categories you can view them in a combined index table and in individual ones using P&T's [Category Sources](https://github.com/pixelandtonic/CategorySources) plugin.
carlcs
CC BY-SA 3.0
2015-05-15T22:50:03.307Z
Thanks - a lot of things cleared up in my head now! Better getting it right before starting.
mmc501
CC BY-SA 3.0
2015-05-15T21:08:38.917Z
2015-05-15T21:08:38.917Z
2017-04-13T12:50:59.930Z
carlcs
<p>I will build a group site in craft which will have the main domain and multiple sub domains.
e.g. 
domain.com
property.domain.com
connect.domain.com</p>

<p>The news feed on each sub domain will be different but it will all display on the main domain news feed. The site build etc for each will be similar but content will be different.</p>

<p>What is the best way to set this up in Craft?</p>

<p>Is the following something which can be done.</p>

<p>Use Multi Environment Config to set the SiteURL for each domain.
Point all the domain/sub domains to the 1 public folder.</p>

<p>Within my main _layout.html template file detect what the siteurl is and based on that include different header and footer files for each sub domain?</p>

<p>The same news template files can then be used. 
And just use a different structure for the nav on each sub domain.</p>

<p>Is that workable and the best way to do it or should I be having different root folders for each sub domain?</p>

<multi-environment><multi-domain><multi-site>
Site set up with mutiple sub domains
# Site set up with mutiple sub domains

(Asked by: username_0 on 2015-05-15)

I will build a group site in craft which will have the main domain and multiple sub domains.
e.g.
domain.com
property.domain.com
connect.domain.com

The news feed on each sub domain will be different but it will all display on the main domain news feed. The site build etc for each will be similar but content will be different.

What is the best way to set this up in Craft?

Is the following something which can be done.

Use Multi Environment Config to set the SiteURL for each domain.
Point all the domain/sub domains to the 1 public folder.

Within my main \_layout.html template file detect what the siteurl is and based on that include different header and footer files for each sub domain?

The same news template files can then be used.
And just use a different structure for the nav on each sub domain.

Is that workable and the best way to do it or should I be having different root folders for each sub domain?

**Tags:** multi-environment, multi-domain, multi-site


---

## 1 answers

### Answer by username_1 on 2015-05-15. Score: 3 | Accepted answer

The approach you described is interesting and should actually work. Separate root folders would allow you to define the template folders individually (→ see [Ben's answer](https://craftcms.stackexchange.com/a/4739/125) on how to set this up), but it looks like that's not what you need and your subdomains are more part of one and the same site.

Even with multiple root and template folders you could still include shared template partials, but sharing CSS, JS and assets would be troublesome. But, then again, more easy to have these individually for each subdomain.

> **Comments:**
> **username_0**: I'm just not sure the best approach to take and that was the first that came to mind. Sharing css/js/assets would be troublesome just with multiple root and shared templates?  
> **username_0**: Say for the news feed if assets are added to an article they would need to be accessible from all domains. Articles would need to appear on the subdomains but all would appear on the main site. Would I be better setting those up as separate channels or just the 1 and use categories to specify what site it is for? Suppose if an article needs to appear on 2 sub domains it would need to be 1 channel?  
> **username_1**: Ok, this now reads even more like your subdomains are just subpages and you're more interested in sharing things than separating them, which all speaks for the one root folder idea. You can have shared CSS, JS and assets above the root, so no problems on that front (relative, root relative or absolute using your multi-env `siteUrl` variable).  
> **username_1**: You can join channels in a template easily via `craft.entries.section('news1, news2')`, so I'd probably rather decide on how you want the content to be structured in the CP, what makes the most sense from the data entry and also the CP index views. With separate channels you're stuck with separate index views, with one channel and categories you can view them in a combined index table and in individual ones using P&T's [Category Sources](https://github.com/pixelandtonic/CategorySources) plugin.  
> **username_0**: Thanks - a lot of things cleared up in my head now! Better getting it right before starting.  

---

