“Multisite configuration”, with a different setup

I am currently working on a new concept for a customer and have to develop a strategy for it in advance. I have a use case in which two different kirby folders are contained under one domain. The subfolder is only accessible to editors and contains additional pages, but I want to physically separate its contents from the main folder.

mainfolder/
├── assets
├── content
├── kirby (4.6.1)
├── media
├── site
├── subfolder/
│   ├── assets
│   ├── content
│   ├── kirby (4.6.1)
│   ├── media
│   ├── site

I would like to maintain only one Kirby folder.
My setup differs from the cookbook “Multisite configuration”.

Do I have to adapt my folder structure to the cookbook, or change the cookbook to match my folder structure?

Your description is somewhat unprecise and from what I understand, this is not a multisite setup but maybe rather a custom folder setup.

  1. I guess with “kirby folder” you mean the project folder, not the kirby folder inside your project folder.

  2. Why two separate projects, with the second one in a subfolder? This would mean having to update 2 projects.

  3. If I understand correctly, all you want to achieve is to have two content folders and then switch between them depending on user role.

Please clarify, thanks!

Hi Sonja, thank you! I haven’t finally decided what the structure will look like in the end. Basically, not only the content folder should be independent, but also the blueprints and templates. These cannot be integrated into the main layout via snippets. The aim is a clear separation of content and templates. And no duplicate Kirby folders.

What you could do:

index.php

<?php

require __DIR__ . '/kirby/bootstrap.php';

// standard kirby
$kirby = new Kirby();

// if logged in user, create custom instance
if ($kirby->user()) {
	
	$kirby = new Kirby([
		'roots' => [
			'content'   => __DIR__ . '/secret/content',
			'templates' => __DIR__ . '/secret/templates'
		]
	]);
}

echo $kirby->render();

Then copy the content and templates and whatever else folders into some other folder (secret in the example).

Downside of this approach is that you have to first create a Kirby instance to check for a user object, and then create a new instance, but that should not usually be an issue.

Thank you for your example. After logging in, only the contents of mydomain/secret/ are currently displayed. However, my goal is to have two independent panels accessible, depending on the URL from which I access the panel.

When I open mydomain/panel/, I should be able to log in there. And when I open mydomain/secret/panel/, I want to be able to log in there separately. Both installations should operate independently of each other, although they access the same Kirby core-folder.

So I tried to use the cookbook for multisite configuration. However, it turned out that neither the panel nor the frontend of the /secret/ folder can be accessed – access is always denied with a 404 error message.

The folder structure I described at the beginning contains two Kirby core folders, but it works as expected. I can live with the compromise of updating two kirby folders.

I see, above you said you wanted them under one domain, not two different ones, which made me believe it was the same website with different content for certain users. So this is indeed a multisite then that runs under two domains, and if I were you and to make things cleaner, I’d run it under a subdomain rather than a subfolder, and then follow the instructions for the multisite.

But if it worked with the two kirby folders, please post the configuration you tried.

above you said you wanted them under one domain, not two different ones

mydomain/panel/
mydomain/secret/panel/

I had hoped that this would indicate that it is the same domain and that each order has its own panel. Sorry if that was not communicated clearly.

I’d run it under a subdomain

Unfortunately, a subdomain is not an option because the provider charges outrageously high fees for SSL certificates for subdomains. Changing providers would also involve too much effort and cost.

But if it worked with the two kirby folders, please post the configuration you tried.

My solution doesn’t contain any special setup because there’s only one more Kirby installation in the main folder: