Different url setups on localhost and remote server

We’d like to use a custom folder and url setup for our next site following the instructions in the docs. But while we’ll have subdomains for the assets and media folders on the remote server, we won’t have those subdomains on our localhost and would like to just use the usual paths.

Is there an easy way to initialise Kirby differently depending on the server context?

Short answer: yes.

In your index.php, you can insert a condition and based on that condition, use a different setup.

It might be obvious but how would I determine the environment in that condition?

Via the $_SERVER array: https://www.php.net/manual/de/reserved.variables.server.php

$_SERVER['HTTP_HOST']

Or in Kirby-syntax:

Url::host()

Cool, thanks!