# Setup multisite - only the content is different

**URL:** <https://forum.getkirby.com/t/setup-multisite-only-the-content-is-different/19454>\
**Category:** Questions\
**Tags:** v3\
**Created:** [September 22, 2020, 9:57am UTC](https://forum.getkirby.com/t/setup-multisite-only-the-content-is-different/19454 "2020-09-22T09:57:18Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vivo](https://avatars.discourse-cdn.com/v4/letter/v/b3f665/32.png) [@Vivo](https://forum.getkirby.com/u/Vivo)\
**Post date:** [September 22, 2020, 9:57am UTC](https://forum.getkirby.com/t/setup-multisite-only-the-content-is-different/19454/1 "2020-09-22T09:57:18Z")

</div>

I’m trying to setup a multisite where 2 websites are 100% identical except the content. So only the content is uniek and should be managed separate in their own panel.

I’ve looked at several posts here on the forum and of course the cookbook: [https://getkirby.com/docs/cookbook/setup/multisite#setting-up-your-multisite](https://getkirby.com/docs/cookbook/setup/multisite#setting-up-your-multisite)

To be honest, I have a hard time understanding the code in the cookbook about the multisite. Can anybody point me in the right direction how I should configure this?

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [September 22, 2020, 10:53am UTC](https://forum.getkirby.com/t/setup-multisite-only-the-content-is-different/19454/2 "2020-09-22T10:53:35Z")

</div>

If it’s only about the content folder, then all you have to do is set `content` to the folder where your content is store in index.php

index.php

```auto
<?php
require 'kirby/bootstrap.php';

// in this array, the key refers to the domain, the value refers to the folder name, this can be different from the domain name. Inside those folders you would put the content and the media folders.
$sites = [
  'my-site.com' => 'my-site.com',
  'my-shop.com' => 'my-shop.com',
];

$host = Url::host();
$root = $sites[$host];
$url = 'http://' . $host;

$kirby = new Kirby([
  'roots' => [
    'index' => __DIR__ ,
    'content' => $root . '/content',
    'media' => $root . '/media',
  ],
 'urls' => [
    'media' => $url . '/' . $root . '/media',
  ],
]);

echo $kirby->render();

```

---

<div class="post-metadata">

**Author:** ![Vivo](https://avatars.discourse-cdn.com/v4/letter/v/b3f665/32.png) [@Vivo](https://forum.getkirby.com/u/Vivo)\
**Post date:** [September 22, 2020, 12:01pm UTC](https://forum.getkirby.com/t/setup-multisite-only-the-content-is-different/19454/3 "2020-09-22T12:01:34Z")

</div>

Ok, thank you.

Just to be sure, the index.php and all other folders I put in the root, let say [www.mysite.com](http://www.mysite.com). The content and media folder I put in [www.mysite.com/site1](http://www.mysite.com/site1) and [www.mysite.com/site2](http://www.mysite.com/site2).

And what information do I put at $sites?

> [@texnixe](#):
>
> ```auto
> $sites = [
> 'my-site.com' => 'my-site.com',
> 'my-shop.com' => 'my-shop.com',
> ];
> 
> ```

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [September 22, 2020, 12:32pm UTC](https://forum.getkirby.com/t/setup-multisite-only-the-content-is-different/19454/4 "2020-09-22T12:32:29Z")

</div>

As I commented above, the array keys in the `$sites` array are your domain names, the values are the folder names where your domain-specific stuff is stored.

---

<div class="post-metadata">

**Author:** ![Vivo](https://avatars.discourse-cdn.com/v4/letter/v/b3f665/32.png) [@Vivo](https://forum.getkirby.com/u/Vivo)\
**Post date:** [September 22, 2020, 12:45pm UTC](https://forum.getkirby.com/t/setup-multisite-only-the-content-is-different/19454/5 "2020-09-22T12:45:44Z")

</div>

Ok, then it should be like this:

$sites = [  
‘[www.mysite.com/site1](http://www.mysite.com/site1)’ =\> ‘site1’,  
‘[www.mysite.com/site2](http://www.mysite.com/site2)’ =\> ‘site2’,  
];

I’m sorry but I don’t understand what this does. The url and the folder are the same thing…

Just to be sure, the index.php and all other folders I put in the root, let say [www.mysite.com](http://www.mysite.com). The content and media folder I put in [www.mysite.com/site1](http://www.mysite.com/site1) and [www.mysite.com/site2](http://www.mysite.com/site2).

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [September 22, 2020, 12:57pm UTC](https://forum.getkirby.com/t/setup-multisite-only-the-content-is-different/19454/6 "2020-09-22T12:57:42Z")

</div>

> [@texnixe](#):
>
> `$root = $sites[$host];`

The root folder is retrieved from the $sites array, depending on which domain is called. Not sure if this works with subfolders. Check what dumping `Url::Host()` returns for each domain

---

<div class="post-metadata">

**Author:** ![Vivo](https://avatars.discourse-cdn.com/v4/letter/v/b3f665/32.png) [@Vivo](https://forum.getkirby.com/u/Vivo)\
**Post date:** [September 22, 2020, 7:23pm UTC](https://forum.getkirby.com/t/setup-multisite-only-the-content-is-different/19454/7 "2020-09-22T19:23:25Z")

</div>

Ok, thank you.

But how does this work!? Because the index.php is in the root folder ([www.mysite.com](http://www.mysite.com)) but in the browser you navigate to [www.mysite.com/site1](http://www.mysite.com/site1)

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [September 22, 2020, 8:25pm UTC](https://forum.getkirby.com/t/setup-multisite-only-the-content-is-different/19454/8 "2020-09-22T20:25:22Z")

</div>

As I said, I don’t know if this works with subfolders instead of (sub)domains, have never tried that. This setup usually assumes that you use domain names that all point to the same root.

Why do you use subfolders if this concerns different website?

---

<div class="post-metadata">

**Author:** ![Adspectus](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/adspectus/32/189_2.png) [@Adspectus](https://forum.getkirby.com/u/Adspectus)\
**Post date:** [September 23, 2020, 11:46am UTC](https://forum.getkirby.com/t/setup-multisite-only-the-content-is-different/19454/9 "2020-09-23T11:46:08Z")

</div>

Maybe the approach which I proposed in [this recipe](https://getkirby.com/docs/cookbook/setup/multisite-variant) is easier for you to accomplish. It requires that you set up 2 virtual hosts, each will serve one of your sites. In addition, you need to have access to your file system because you have to replace folders with symbolic links. If this does not fit your situation, you can skip the remaining part of this answer.

Once you have setup your file system and virtual hosts as it is proposed in the mentioned recipe, it is easy to extend it to the `site` and `assets` folders. You just need to replace them with the according symbolic links.

In the following example file structure I did this and moved the `kirby`, `site` and `assets` folder to a folder `kirby-shared` outside of the virtual hosts root folders, which are `kirby-site1/htdocs` and `kirby-site2/htdocs`. Then I replaced these folders with symbolic links to the shared folder:

```auto
kirby-shared/
├── assets
├── kirby
└── site
kirby-site1/
└── htdocs
    ├── assets -> ../../kirby-shared/assets
    ├── content
    │ ├── 1_photography
    │ ├── 2_notes
    │ ├── 3_about
    │ ├── error
    │ ├── home
    │ └── sandbox
    ├── kirby -> ../../kirby-shared/kirby
    ├── media
    │ ├── pages
    │ └── panel
    └── site -> ../../kirby-shared/site
kirby-site2/
└── htdocs
    ├── assets -> ../../kirby-shared/assets
    ├── content
    │ ├── 1_photography
    │ ├── 2_notes
    │ ├── 3_about
    │ ├── error
    │ ├── home
    │ └── sandbox
    ├── kirby -> ../../kirby-shared/kirby
    ├── media
    │ ├── pages
    │ └── panel
    └── site -> ../../kirby-shared/site

```

This is a real working example, just created with the recent starterkit. If you like, I can give you access to it to test.

---

<div class="post-metadata">

**Author:** ![Vivo](https://avatars.discourse-cdn.com/v4/letter/v/b3f665/32.png) [@Vivo](https://forum.getkirby.com/u/Vivo)\
**Post date:** [September 23, 2020, 2:05pm UTC](https://forum.getkirby.com/t/setup-multisite-only-the-content-is-different/19454/10 "2020-09-23T14:05:40Z")

</div>

I don’t see the difference between using subfolders or a different domain. Setup would be te same, only the reference of the url is different.

The goal is to maintain the templates, snippets, blueprint and assets in 1 place.

Another possibility is that site1 has a regular setup, and site2 uses the templates, snippets, blueprint and assets from site1.

---

<div class="post-metadata">

**Author:** ![Vivo](https://avatars.discourse-cdn.com/v4/letter/v/b3f665/32.png) [@Vivo](https://forum.getkirby.com/u/Vivo)\
**Post date:** [September 23, 2020, 2:07pm UTC](https://forum.getkirby.com/t/setup-multisite-only-the-content-is-different/19454/11 "2020-09-23T14:07:57Z")

</div>

Thanks for sharing. Looks like a complex setup, but might be an option.

---

<div class="post-metadata">

**Author:** ![loremipsum](https://avatars.discourse-cdn.com/v4/letter/l/f19dbf/32.png) [@loremipsum](https://forum.getkirby.com/u/loremipsum)\
**Post date:** [October 13, 2020, 8:54am UTC](https://forum.getkirby.com/t/setup-multisite-only-the-content-is-different/19454/12 "2020-10-13T08:54:26Z")

</div>

Oh this is exactly the setup I need. I’m pretty lost though. Could you provide me your Starterkit sample files?

---

<div class="post-metadata">

**Author:** ![Adspectus](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/adspectus/32/189_2.png) [@Adspectus](https://forum.getkirby.com/u/Adspectus)\
**Post date:** [October 13, 2020, 9:12am UTC](https://forum.getkirby.com/t/setup-multisite-only-the-content-is-different/19454/13 "2020-10-13T09:12:13Z")

</div>

There is nothing special with the starterkit files I use for this. Just set up the `kirby-site1` and `kirby-site2` folders with the same starterkit and then move the folders of one site outside the virtual hosts docroots and replace all moved folders with a symbolic link. For the second and maybe even more sites just delete the folders and replace them by symbolic links. Just follow the cookbook recipe, especially the change to index.php: [https://getkirby.com/docs/cookbook/setup/multisite-variant#in-index-php](https://getkirby.com/docs/cookbook/setup/multisite-variant#in-index-php)

If you are still lost, please specify at which point something is not working for you.

---

<div class="post-metadata">

**Author:** ![loremipsum](https://avatars.discourse-cdn.com/v4/letter/l/f19dbf/32.png) [@loremipsum](https://forum.getkirby.com/u/loremipsum)\
**Post date:** [October 21, 2020, 12:05pm UTC](https://forum.getkirby.com/t/setup-multisite-only-the-content-is-different/19454/14 "2020-10-21T12:05:17Z")

</div>

Thanks, I was struggling with the Symbolic Links but now it’s working like a charm 🙂

---

<div class="post-metadata">

**Author:** ![loremipsum](https://avatars.discourse-cdn.com/v4/letter/l/f19dbf/32.png) [@loremipsum](https://forum.getkirby.com/u/loremipsum)\
**Post date:** [October 22, 2020, 8:31am UTC](https://forum.getkirby.com/t/setup-multisite-only-the-content-is-different/19454/15 "2020-10-22T08:31:20Z")

</div>

Since the site/config folder is shared between two sites, how can I add a second license?

---

<div class="post-metadata">

**Author:** ![Adspectus](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/adspectus/32/189_2.png) [@Adspectus](https://forum.getkirby.com/u/Adspectus)\
**Post date:** [October 22, 2020, 9:45am UTC](https://forum.getkirby.com/t/setup-multisite-only-the-content-is-different/19454/16 "2020-10-22T09:45:58Z")

</div>

Good question - never thought about this, since initially, my primary goal has been to share the kirby program folder and to ease updating/testing with different versions.

However, thinking more about it, it would be better to not share the whole `site` folder, but only certain subfolders. I think I would definitely leave the `cache`, `config` and `session` subfolders as real folders and only symlinking the others like blueprints, controllers etc. Depends largely on what you want to achieve. If you would like to share accounts between your sites, share the `accounts` folder, if not, leave them alone.

---

<div class="post-metadata">

**Author:** ![luca](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/luca/32/5591_2.png) [@luca](https://forum.getkirby.com/u/luca)\
**Post date:** [April 19, 2021, 9:36pm UTC](https://forum.getkirby.com/t/setup-multisite-only-the-content-is-different/19454/17 "2021-04-19T21:36:12Z")

</div>

If I want to share accounts between two kirby sites in a multisite installation, do I only have to point the accounts root to the same folder or also the sessions root? @texnixe

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [April 19, 2021, 9:56pm UTC](https://forum.getkirby.com/t/setup-multisite-only-the-content-is-different/19454/18 "2021-04-19T21:56:21Z")

</div>

Only the accounts. Users cannot be logged in into 2 Panels at the same time.
