In Kirby 2, we could set the config file to set a multisite.
https://getkirby.com/docs/archive/v2 (see multi-site setup chapter)
Can we do similar setup with Kirby 3?
In Kirby 2, we could set the config file to set a multisite.
https://getkirby.com/docs/archive/v2 (see multi-site setup chapter)
Can we do similar setup with Kirby 3?
Should actually be possible, in the same way as the custom folder/custom URL setup in your index.php. Try creating a new Kirby object depending on domain, similar to what you tried in the Slack channel, just not depending on user role but on domain.
I just had to redo it myself for a multisite setup. Here’s my code for the index.php in kirby3 if it can help anyone looking for an example:
<?php
require 'kirby/bootstrap.php';
$domains = array('kirby3.test', 'sub.kirby3.test');
if(url::host() == "kirby3.test") {
echo (new Kirby)->render();
}
else if(url::host() == "sub.kirby3.test") {
$kirby = new Kirby([
'roots' => [
'index' => __DIR__,
'site' => __DIR__ . '/sub/site',
'content' => __DIR__ . '/sub/content',
'media' => __DIR__ . '/sub/media'
],
'url' => [
'index' => __DIR__,
'content' => __DIR__ . '/sub/content',
'media' => __DIR__ . '/sub/media',
'media' => __DIR__ . 'https://sub.kirby3.test',
]
]);
echo $kirby->render();
}
In Kirby 2 my site.php was :
<?php
$kirby = kirby();
$domains = array('kirby2.fr', 'sub.kirby2.test');
switch(url::host()) {
case 'kirby2.test':
$kirby->roots->content = $kirby->roots()->index() . DS . 'content' . DS . '';
$kirby->roots->site = $kirby->roots()->index() . DS . 'site' . DS . '';
$kirby->roots->thumbs = $kirby->roots()->index() . DS . 'thumbs' . DS . '';
$kirby->urls->content = $kirby->urls()->index() . '/content';
$kirby->urls->thumbs = $kirby->urls()->index() . '/thumbs';
$kirby->urls->index = 'http://kirby2.test';
break;
case 'sub.kirby2.test':
$kirby->roots->content = $kirby->roots()->index() . DS . '/sub/content' . DS . '';
$kirby->roots->site = $kirby->roots()->index() . DS . '/sub/site' . DS . '';
$kirby->roots->thumbs = $kirby->roots()->index() . DS . '/sub/thumbs' . DS . '';
$kirby->urls->content = $kirby->urls()->index() . '/sub/content';
$kirby->urls->thumbs = $kirby->urls()->index() . '/sub/thumbs';
$kirby->urls->index = 'http://sub.kirby2.test';
break;
}
?>
@Thomasorus Thanks a lot for sharing, that is exactly what I meant .
Thanks @texnixe and @Thomasorus, your explanations and snippet example help a lot
This might be Cookbook material…
(…more characters)