Multisite not loading CSS/assets?

Thank you Lukas for your help, this that works pretty well apart from Panel fails with:

Fatal error: The site directory is missing in: /.../Sites/multisite/kirby/kirby.php on line 536

Any ideas?

Oh yes, I forgot: The Panel currently expects the site to be in the parent directory of the Panel directory.

Could you please try what happens if you change line 8 in multisite/panel/index.php to this:

$index = realpath('..');

Sadly the same error

Hm. Unfortunately the setup won’t work that way then.

Only way would be to return to a “standard” multisite setup like you had in the beginning. What you would need to change is your js() and css() calls (and the URLs of other assets):

<?= css('websites/' . server::get('server_name') . '/assets/css/whatever.css'); ?>

That is a shame, I don’t think re-linking stuff is really viable. I thought there would be a way for a single kirby install with multiple sites - can this be put in for future versions?

Thanks for all your help Lukas.

Well, as I said, Kirby does support multisite setups like the one you had in the beginning. You just need to change the URLs to your assets. Alternatively you can use a global assets directory for all of your sites (if the assets are the same or similar for all sites).

i got this setup working!

…by changing the path to the host/customers child folder (and not the panel’s parent folder as suggested).

in panel/index.php - like so:

$index = dirname('test2.dev')

or more flexibel, a directory based on the hostname:

function giveHost($host_with_subdomain) {
  $array = explode(".", $host_with_subdomain);
  return (array_key_exists(count($array) - 2, $array) ? $array[count($array) - 2] : "").".".$array[count($array) - 1];
}

// fetch the site's index directory
$index = dirname(__DIR__) . DS . giveHost($_SERVER[HTTP_HOST]);

the ugly thing is that this change has to be done after each update of the panel. it would be great if the panel could also be configured via the site.php in in the host/client folder.

On a side note, you should no longer use .dev as a local domain name. Chrome, Chrome based browsers, and Firefox will not work properly any more with.dev. You should use something else like .test

Basically Google now owns .dev as a real domain name, so you cant use it locally.