Multisite with folders


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

Not exactly sure how to structure the index.php file :thinking:

require 'kirby/bootstrap.php';

$sites = [
  '' => 'site1',
  '' => 'site2',
  '' => '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();

This will only return but not the subfolder, I think…

Have you already looked at the cookbook recipes Using Kirby for multiple sites and especially A variant to using Kirby for multiple sites?

1 Like

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

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 :thinking:


require 'kirby/bootstrap.php';

echo (new Kirby)->render();

You have to adapt the index.php as well, see the recipe:

1 Like

Aaa :man_facepalming: didn’t see the tutorial continued! Working now :muscle: :muscle: thanks!