Multi-Page setup and issues with panel

For sanity’s sake, I’m trying to implement my kirby site with an (internal only) “staging” part and a public website, which I started on plainkit, 3.2.2 and meanwhile upgraded to 3.2.3. My path is based on what I’ve read here, primarily: https://getkirby.com/docs/cookbook/setup/multisite

I have added two directories to which index.php points to fl-staging or fl-prod respectively:

<?php

require 'kirby/bootstrap.php';

$sites = [
  'example.com' => __DIR__ . '/fl-prod',
  'www.example.com' => __DIR__ . '/fl-prod',
  'staging.example.com' => __DIR__ . '/fl-staging',
];

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

$kirby = new Kirby([
  'roots' => [
    'index'   => __DIR__,
    'site'    => $root . '/site',
    'assets'    => $root . '/assets',
    'content' => $root . '/content',
    'media'   => $root . '/media',
    'accounts' => __DIR__. '/fl-all/site/accounts',
  ]
]);

echo $kirby->render();`

The directory structure is as follows

+ fl-all/
   + site/
      + accounts/
+ fl-prod
   + assets/
   + content/
   + media/
   + site/
      + blueprints/
      + cache/
      + config/
      + sessions/
      + snippets/
      + templates/
- index.php
+ kirby/

I am now completely lost: the panel does not work (Javascripts will load the error page which is in the site, i.e. a one of the template/content files). When I move the media to the root level, it works. But the media path $kirby->roots()->media() is fl-staging/media` for example.

To me it looks somewhat similar to the effects here: Panel breaks on multi-site setup with per-site accounts

As a side note: I have some issues with the images in the panel, both icons as well as for example user profile images keep breaking in the panel, but work when running the site itself. Don’t know whether that points to some related issue – I have beforehand suspected that I have made an error in one of the blueprints.

Any thoughts on that?

Tried a similar setup locally and couldn’t get it to work, either.

Thanks a lot! That is very helpful to know. If I correctly understand what you have reproduced, this would mean that the information in https://getkirby.com/docs/cookbook/setup/multisite is not accurate or that it’s some bug. What do you think? (Depending on that, I could file an issue or just forget about it for the time being).

As for me: I just moved the folder as work-around and will first do without a staging setup.

I think it’s probably a bug, already described here: Can't load panel of multi-site setup after upgrading to 3.2, but that sort of mysteriously solved itself. But maybe it just auto-created a media folder somewhere else…

The files do in fact exist but are not recognized as JS files, it seems.

Thanks for your support and providing a tech-savier evaluation!

I created a bug report an GitHub:

Oh, you beat me to it, it wasn’t there when I started mine…

Oh sorry, that was unintended – depending on what you deem most suitable, I can well remove mine (if technically possible which I assume).

No problem, I’ve closed mine and linked to it from yours…

This issue is now closed because the error is in the setup (and missing documentation how to do it correctly)

$kirby = new Kirby([
  'roots' => [
    'media' => __DIR__ . '/media/test'
  ],
  'urls' => [
    'media' => 'http://yourdomain.com/media/test'
  ]
]);

Hi texnixe,

thank you. I actually had a look at the issue yesterday by chance (as the panel broke due to the wrong setup – corrected with changing the dirs as a work-around). I think the whole directory setup suggested is then bogus (cf. my comment to the issue): when the root is a subdirectory of the site page, you would have https://site1.example.com/site1/media as URL which really looks ugly. As I don’t know the working mechanics, I cannot make any suggestions at this point, though.

Best,
Baltasar