Kirby multiple websites questions

Hey…
today i just purchased a second license for another website… since both websites will only differ in domain-name and content-folder, my idea was to have same site folder.
Is it possible to have two licenses in the same folder? i tried to register one after each other. but the .license file was overwritten each time.

thx

those three links did not help for the license-file question:



The license is written into the config folder, therefore I guess you need a different config folder for each site (put that folder together with the content folder).

(new Kirby([
   //...
   'roots' => [
     //...
     'config' => "$websiteRoot/config"
   ]
])->render();

Of course that folder then needs to also contain your config file (if you have one), and if you want to keep that “DRY”, you could always copy a config file that just returns the values of a global one:

<?php

return include '/my/global/config.php';

well… there is a possibility for multisite configs in the same configfolder… that makes only sense if the same goes with licenses… or did i oversee something? =)

You mean this https://getkirby.com/docs/guide/configuration#multi-environment-setup ?

I think that feature is intended to support “the same site in different environments”, like: a config file for testing, one for staging, one for production.
Not so much for “different sites in the same environment”.

Multiple Licenses in one file or multiple licensefiles in one folder would open such environment =)

@rasteiner thx a lot… it seems to work with your solution on config folder…

now, since i managed the license-question, i got new questions…

is it possible to rewrite base for multiple sites? reason: every site has now urls like domain.tld/subfolder/... for everything except pages… so for the the media and assets.

that makes it difficult for some urls pointing to "/assets/..." maybe this is bad coding behaviour… but there are plugins that use root folder as base… in my case “lessphp” of thezero theme throws: File /var/www/html/assets/app/custom/app.less not found.#

in Line 2793 /var/www/html/site/plugins/lessphp/lib/Less/Parser.php
whenn enabling style compiler. and also assets are not found, because url generating of css, js etc. is now broken… @mrfreedom any idea on this?

Hi, @demlak.

Yes, site/theme/snippets/less.php is using realpath linking. Some people suggested it, because of issues in some environments, so I whent along. Just change it.

Open that file and at the top you will see

// Using 'realpath' seems to work best in different situations.
$root = realpath(__DIR__ . "/../../..");

Just change the code before Less library activation.

1 Like

thx a lot…

i was able to manage the style compiling by setting correct paths in the snippet…

// Main Less file.
$sourceFile = $kirby->root('assets') . "/app/custom/app.less";
// Final CSS file.
$compiledFile = $kirby->root('assets') . "/app/dist/css/uikit.app.min.css";

// Options
$options = array(
    'compress'=>true,
    'cache_dir' => $kirby->root('site') . '/cache/less'
);

but the generated output still produces wrong urls to assets…
for example (as you can see: no numbers before file extensions):

    <link href="https://www.ecovillage-hannover.de/assets/app/dist/css/uikit.app.min..css" rel="stylesheet">  
  <script src="https://www.ecovillage-hannover.de/assets/app/dist/js/uikit.min..js"></script>
  <script defer src="https://www.ecovillage-hannover.de/assets/app/dist/js/uikit-icons.min..js"></script>  
1 Like

Than that’s the issue with Kirby 3 Cachebuster plugin.
Make sure you added Cachebuster htaccess code for that other website.

thx a lot…
i disabled the plugin to test… (tried also with or without the coresponding part in the .htaccess file)

still there were hardcoded folders in snippet header.php

i changed them:

  <?= css([$kirby->url('assets') . '/app/dist/css/uikit.app.min.css']) ?>
  <?= css('@auto') ?>

  <?= js($kirby->url('assets') . '/app/dist/js/uikit.min.js') ?>

  <?= js($kirby->url('assets') . '/app/dist/js/uikit-icons.min.js', ['defer' => true]) ?>
  <?= js('@auto') ?>

now it works without cachebuster plugin… i’ll try to contact @schnti via github issue… we’ll see…

i fixed it: https://github.com/schnti/kirby3-cachebuster/issues/7#issuecomment-723351017
(Edit: narf… now i see, there is already a pull request from may 2019, which also reflects this… this plugin seems to be orphaned)

now… everything in multi-url setup works…
but i still would prefer to hide subfolder of each domain…

is it possible to rewrite base for multiple sites? reason: every site has now urls like domain.tld/subfolder/… for everything except pages… so for the the media and assets.