# Multisite with folders

**URL:** <https://forum.getkirby.com/t/multisite-with-folders/17688>\
**Category:** Questions\
**Tags:** v3\
**Created:** [March 25, 2020, 4:35pm UTC](https://forum.getkirby.com/t/multisite-with-folders/17688 "2020-03-25T16:35:48Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![johan](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/johan/32/7322_2.png) [@johan](https://forum.getkirby.com/u/johan)\
**Post date:** [March 25, 2020, 4:35pm UTC](https://forum.getkirby.com/t/multisite-with-folders/17688/1 "2020-03-25T16:35:48Z")

</div>

Hi,

I’m trying to create a multisite that shares the same kirby folder.

[example.com/site1](http://example.com/site1)  
[example.com/site2](http://example.com/site2)  
[example.com/site3](http://example.com/site3)

 ![Screenshot 2020-03-25 at 17.28.48](https://europe1.discourse-cdn.com/flex017/uploads/getkirby/original/2X/3/33944d70c7636452366cb1d13fcc7d09bde529db.png)

Not exactly sure how to structure the index.php file 🤔

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

$sites = [
  'example.com/site1' => 'site1',
  'example.com/site2' => 'site2',
  'example.com/site3' => 'site3',
];

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

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

echo $kirby->render();

```

---

<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:** [March 25, 2020, 4:40pm UTC](https://forum.getkirby.com/t/multisite-with-folders/17688/2 "2020-03-25T16:40:09Z")

</div>

> [@johan](#):
>
> $root = $sites[$host]

This will only return `example.com` but not the subfolder, I think…

---

<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:** [March 25, 2020, 5:41pm UTC](https://forum.getkirby.com/t/multisite-with-folders/17688/3 "2020-03-25T17:41:08Z")

</div>

Have you already looked at the cookbook recipes [Using Kirby for multiple sites](https://getkirby.com/docs/cookbook/setup/multisite) and especially [A variant to using Kirby for multiple sites](https://getkirby.com/docs/cookbook/setup/multisite-variant)?

---

<div class="post-metadata">

**Author:** ![johan](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/johan/32/7322_2.png) [@johan](https://forum.getkirby.com/u/johan)\
**Post date:** [March 25, 2020, 5:43pm UTC](https://forum.getkirby.com/t/multisite-with-folders/17688/4 "2020-03-25T17:43:29Z")

</div>

Currently trying the “A variant to using Kirby for multiple sites”, this should work!

---

<div class="post-metadata">

**Author:** ![johan](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/johan/32/7322_2.png) [@johan](https://forum.getkirby.com/u/johan)\
**Post date:** [March 25, 2020, 6:06pm UTC](https://forum.getkirby.com/t/multisite-with-folders/17688/5 "2020-03-25T18:06:34Z")

</div>

Got the symbolic links working but navigating the sites I get the following error:

`Warning: require(kirby/bootstrap.php): failed to open stream: No such file or directory in /srv/users/username/apps/example-domain/public/site1/index.php on line 3`

Maybe it’s the index.php that doesn’t find kirby/bootstrap.php because kirby is a symbolic link 🤔

```auto
<?php

require 'kirby/bootstrap.php';

echo (new Kirby)->render();

```

---

<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:** [March 25, 2020, 6:21pm UTC](https://forum.getkirby.com/t/multisite-with-folders/17688/6 "2020-03-25T18:21:02Z")

</div>

You have to adapt the index.php as well, see the recipe: [https://getkirby.com/docs/cookbook/setup/multisite-variant#in-index-php](https://getkirby.com/docs/cookbook/setup/multisite-variant#in-index-php)

---

<div class="post-metadata">

**Author:** ![johan](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/johan/32/7322_2.png) [@johan](https://forum.getkirby.com/u/johan)\
**Post date:** [March 25, 2020, 6:23pm UTC](https://forum.getkirby.com/t/multisite-with-folders/17688/7 "2020-03-25T18:23:05Z")

</div>

Aaa 🤦‍♂️ didn’t see the tutorial continued! Working now 💪 💪 thanks!
