Multisite configuration
You can run multiple sites via the same Kirby setup. This can help you maintain your sites as you only need to keep a single setup updated.
Custom folder and URL setup
A multi-site setup extends Kirby’s features to define your custom folder setup and custom URL setup.
Setting up your multisite
To run multiple sites on a single Kirby installation, modify the index.php
at the root of your installation:
Let's walk through this step by step: First we load the kirby/bootstrap.php
script and define our sites in an array with the domain as the key and the file directory root as the value:
Then we use the Url::host()
method to retrieve the domain requested by the visitor and select the matching root for this one:
Finally, we use this information to create a $kirby
object with custom roots and a custom URLs and output $kirby->render()
:
In the filesystem
Licenses for your multi-site
Even when running multiple sites through the same setup and code, you need a license for each of these sites: A single license is valid for a single Kirby installation, running on a single domain. If you add additional installations (i.e. under additional subdomains or subfolders) you need to purchase licenses for each of those installations.
Further reading
You can also set up a multi-site environment via symlinks, see Alternative multisite setup.