# Multi site and Custom folder setup not working

**URL:** <https://forum.getkirby.com/t/multi-site-and-custom-folder-setup-not-working/12979>\
**Category:** Questions\
**Tags:** v3\
**Created:** [February 20, 2019, 8:59pm UTC](https://forum.getkirby.com/t/multi-site-and-custom-folder-setup-not-working/12979 "2019-02-20T20:59:06Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![felixbridell](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/felixbridell/32/6626_2.png) [@felixbridell](https://forum.getkirby.com/u/felixbridell)\
**Post date:** [February 20, 2019, 8:59pm UTC](https://forum.getkirby.com/t/multi-site-and-custom-folder-setup-not-working/12979/1 "2019-02-20T20:59:07Z")

</div>

I have made this multi site and custom folder setup and got everything working except when I try to access the panel, it then can’t find the media folder.

This is my folder structure:

```auto
root
 |-- domains
 | |-- domain_1
 | | |-- content
 | | |-- media
 | | 
 | |-- domain_2
 |
 |-- kirby
 |-- public (web root folder)
 | |-- assets
 | |-- index.php   
 |
 |-- site

```

My web server points to the root/public folder, and this is my root/public/index.php file:

```auto
<?php
include dirname( __DIR__ ) . '/kirby/bootstrap.php';

$sites = [
  'local.domain_1' => dirname( __DIR__ ) . '/domains/domain_1',
  'local.domain_2' => dirname( __DIR__ ) . '/domains/domain_2',
];

$url = Url::host();
$domainRoot = $sites[$url];

$kirby = new Kirby([
  'roots' => [
    'index' => __DIR__ ,
    'base' => $base = dirname( __DIR__ ),
    'site' => $base . '/site',
    'content' => $domainRoot . '/content',
    'media' => $domainRoot . '/media'
  ]
]);

echo $kirby->render();

```

The front works good but when I navigate to local.domain\_1/panel I get a blank page. If I inspect that blank page I can see that all the assets (css and js) are missing. So I tried to copy the root/domain\_1/media folder to root/public/media and it all works. So it looks like the media root from the index.php doesn’t point to the right place. But the content folder works fine, so what am I missing?

---

<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:** [February 20, 2019, 9:20pm UTC](https://forum.getkirby.com/t/multi-site-and-custom-folder-setup-not-working/12979/2 "2019-02-20T21:20:17Z")

</div>

I think the media folder must be publicly accessible, which it isn’t if it is above the public root folder.

---

<div class="post-metadata">

**Author:** ![felixbridell](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/felixbridell/32/6626_2.png) [@felixbridell](https://forum.getkirby.com/u/felixbridell)\
**Post date:** [February 21, 2019, 4:11am UTC](https://forum.getkirby.com/t/multi-site-and-custom-folder-setup-not-working/12979/3 "2019-02-21T04:11:11Z")

</div>

Well that makes sense of course. I will rethink my folder structure and test that.

---

<div class="post-metadata">

**Author:** ![felixbridell](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/felixbridell/32/6626_2.png) [@felixbridell](https://forum.getkirby.com/u/felixbridell)\
**Post date:** [February 21, 2019, 5:10am UTC](https://forum.getkirby.com/t/multi-site-and-custom-folder-setup-not-working/12979/4 "2019-02-21T05:10:31Z")

</div>

I still have trouble with the media folder.  
I have now change the folder structure to be like:

```auto
root
 |-- kirby
 |
 |-- public
 | |-- assets
 | |
 | |-- media
 | | |-- domain_1
 | | |-- domain_2
 | |
 | |-- index.php
 |
 |-- site
 |-- storage
 | |-- accounts
 | |
 | |-- domain_1
 | | |-- cache
 | | |-- content
 | | |-- sessions
 | |
 | |-- domain_2

```

And then in the public/index.php

```auto
<?php
include dirname( __DIR__ ) . '/kirby/bootstrap.php';

$sites = [
  'local.domain_1' => 'domain_1',
  'local.domain_2' => 'domain_2
];

$url = Url::host();
$baseRoot = dirname( __DIR__ );
$storageRoot = dirname( __DIR__ ) . '/storage';
$domainRoot = dirname( __DIR__ ) . '/storage/' . $sites[$url];
$mediaRoot = __DIR__. '/media/' . $sites[$url];

$kirby = new Kirby([
  'roots' => [
    'index' => __DIR__ ,
    'site' => $baseRoot . '/site',
    'accounts' => $storageRoot . '/accounts',
    'cache' => $domainRoot . '/cache',
    'sessions' => $domainRoot . '/sessions',
    'content' => $domainRoot . '/content',
    'media' => $mediaRoot
  ]
]);

echo $kirby->render();

```

I left the accounts and media folders empty to force a new panel install. Still getting a blank panel page. I can see that the Panel installer have created the necessary **panel** and **plugins** folder inside the **public/media/domain\_1**. If I copy them one level up to the **public/media** folder it works. Is it not possible to have my own sub folders for each domain inside the media folder?

---

<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:** [February 21, 2019, 11:53pm UTC](https://forum.getkirby.com/t/multi-site-and-custom-folder-setup-not-working/12979/5 "2019-02-21T23:53:46Z")

</div>

Probably not, because the media route is hardcoded, also see this thread: [Routing to /media content instead of /media folder structure](https://forum.getkirby.com/t/routing-to-media-content-instead-of-media-folder-structure/12978/9)

---

<div class="post-metadata">

**Author:** ![felixbridell](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/felixbridell/32/6626_2.png) [@felixbridell](https://forum.getkirby.com/u/felixbridell)\
**Post date:** [February 22, 2019, 4:15am UTC](https://forum.getkirby.com/t/multi-site-and-custom-folder-setup-not-working/12979/6 "2019-02-22T04:15:07Z")

</div>

Ok, so it might be a bug… Thank you for your answers.

---

<div class="post-metadata">

**Author:** ![felixbridell](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/felixbridell/32/6626_2.png) [@felixbridell](https://forum.getkirby.com/u/felixbridell)\
**Post date:** [June 28, 2019, 6:38am UTC](https://forum.getkirby.com/t/multi-site-and-custom-folder-setup-not-working/12979/7 "2019-06-28T06:38:26Z")

</div>

This one is fixed now with the Kirby 3.1.3 version. Everything is working great now. Thanks for all the help.
