Hi there,
I am currently working on a larger web project and to try out things I would like to have multiple instances of the frontend that can be hosted on different sub urls to showcase the features. Those frontends should all be accessing the same content folder. I believe this is possible but I just can’t figure out how to set this up. Is this also covered by Routing?
Thank you for your help!
Thank you! I found that but I didn’t fully understand it.
What I want to do is have a shared content and media folder that connects to multiple sites and assets folders.
I tried setting up the folder structure like so:
Project
content
kirby
media
index.php
dev_01
site
assets
dev_02
site
assets
Then I set up the index.php like so (just testing it on localhost at the moment):
<?php
require 'kirby/bootstrap.php';
$sites = [
'localhost:8000/dev_01' => 'localhost:8000/dev_01'
];
$host = Url::host();
$root = $sites[$host];
$url = 'http://' . $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();`
But I get the error:
Warning : Unknown: failed to open stream: No such file or directory in Unknown on line 0
**Fatal error** : Unknown: Failed opening required 'kirby/router.php' (include_path='.:') in **Unknown** on line **0**
The value must point to the folder in your filesystem…
So should it be this? Because that is also not working. I’m sorry to be so oblivious!
$sites = [
'localhost:8000/dev_01' => '/dev_01'
];
You could just try to install to 2 sites, then replace the content and the media folder with symbolic links to a common content and media folder. The following layout works for me (additionally replaced the kirby folder with a symbolic link):
1 Like
Thank you! Turns out it’s actually as simple as
$kirby = new Kirby([
'roots' => [
'index' => __DIR__,
'site' => __DIR__ . '/site',
'assets' => __DIR__ . '/assets',
'content' => '../content',
'media' => '../media'
]
]);