Hello ![]()
I’m just starting to explore setting up a site using Kirby with a public/private split and run into an issue with the media directory being created next to public instead of inside of it. I’ve set things up locally using the following tools:
- Windows + PowerShell 7.5.2
- PHP 8.4.11
- ddev 1.24.7
- composer 2.8.10
- getkirby/cms 5.0.3
and the following steps:
mkdir my-project.com
cd my-project.com
ddev config --php-version=8.4 --omit-containers=db --docroot=public
ddev start
ddev composer create-project getkirby/starterkit my-project.com
ddev composer update
# Updated index.php following https://getkirby.com/docs/guide/configuration/custom-folder-setup#public-and-private-folder-setup
# Moved `assets/`, `media/`, `.htaccess`, `favicon.ico`, and `index.php` into `public/`
This gets me a working site and also the ability to access the panel and play around. Things are generally working.
However, one thing is broken: the media directory is being generated next to public and not inside of it. Things only worked because I manually moved media into public, but deleting both the one in public and the one next to it and then getting the media directory to be regenerated, I’m left with the one outside public. That breaks any asset retrieval including access to the panel.
Am I missing some steps for the public/private split setup (see Custom folder setup | Kirby CMS) for this to work? The documentation suggests to generally leave media alone, but that can’t be right since it has to be in the document root to be accessible by the web server.
Notes:
- I tried the exact same setup on macOS with the same results. Though I should note that once after
ddev startand loading the site, the site managed to load all assets but on the next reload, the assets were broken again. - I tried setting the
mediaroot to__DIR__ . '/media'in index.php manually, but that didn’t change anything. After checkingdump(kirby()->roots());this seems to be unnecessary anyway as the media root is correctly configured ([media] => /var/www/html/public/media) even without specifying it manually. Given this, I feel like what I’m seeing might be a bug. - The media URLs generated by kirby when accessing the site or the panel seem to be correct. Example:
https://my-project.com.ddev.site/media/panel/18313f04cea0e078412a028c5361bd4e/css/style.min.css. - I thought briefly whether a symbolic link from
public/mediatomediawould fix this, but I develop on Windows and there are no native ways for creating symbolic links which makes this a non-starter. I also don’t think doing that would be wise in light of trying to tighten file access via the public/private split setup. - The site will ultimately live on a shared host and I have not yet looked into whether the public/private split setup will cause me problems there.
As an aside, the “Public folder setup” link in the Different use cases > Existing project section on Kirby meets DDEV | Kirby CMS doesn’t open the “Public folder setup” tab.

