Routing to /media content instead of /media folder structure


I’ve updated Kirby2 to Kirby3. I have a content page in /content/media, but since kirby3 added a new /media folder in it’s root directory, im getting routed to the /media file structure now instead of the content media page. I guess i have to write a specific routing within .htaccess to fix that?

You can change the media root path and URL to something else in the index.php file:

$kirby = new Kirby([
    'roots' => [
        'media' => __DIR__ . '/files',
    'urls' => [
        'media' => url('files'),

echo $kirby->render();

No change required in the .htaccess file:

1 Like

Hello pedroborges,
Thank you for your reply! Could it be that kirby(3) has problems in creating thumbs then? Now it’s missing images in ****/files/pages/media/subpage/171542830-1550673474/pic.jpg

Kirby will create thumbnails as needed when each page is accessed. Make sure the /files folder is writable. In my test, I just added that setting and it worked fine. It may vary in your system.

ok - I guess something else is wrong… thanks!

Hm, can’t get this to work, either. If I remove the urls, then the frontend files work, but the Panel doesn’t. What version did you test with, @pedroborges?

I tested yesterday on 3.0.0 and it seemed to work, tested again today I can confirm it only works on the front-end when you set just the option. I hadn’t test the panel, looking now it doesn’t work with a custom media root. It still try to load assets from media.

This may be a bug because in the file kirby/config/routes.php have media hardcoded and doesn’t take the option into account.

So… any other ideas? :slight_smile:

Hm, not really. I created an issue on GitHub:

This is now fixed.