We want to install Kirby into a subfolder(*): example.tld/kirby/.
Goal: Kirby should render pages on the top path such as example.tld/bob .
As a first step, we tried if kirby works from the subfolder, it does.
Inside example.tld/kirby/ now everything works as expected.
- the panel is available at example.tld/kirby/panel
- access to media below example.tld/kirby/media/ , the .jobs are created and the media files work there (gd works).
- example.tld/kirby/bob is rendered based on example.tld/kirby/content/bob/default.txt
To let kirby understand it should treat “/” as site URL and render example.tld/bob based on example.tld/kirby/content/bob/default.txt, we did the following in a second step:
# example.tld/.htaccess at the end of this file
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ kirby/index.php [QSA,L]
# kirby/index.php
<?php
require 'kirby/bootstrap.php';
$kirby = new \Kirby\Cms\App([
'urls' => [
'media' => '/kirby/media',
]
]);
echo $kirby->render();
# kirby/site/config/config.php
<?php
return [
'url' => 'example.tld/',
];
# kirby/.htaccess
# ... where the RewriteBase is mentioned...
RewriteBase /kirby
Given these settings
- example.tld/bob renders html
- example.tld/panel shows and kind of works.
- The Panel is able to upload images into content, and then tries to load example.tld/kirby/media/pages/bob/examplefile/8ac4e5a4da-1733297487/examplefile-76x.jpg but this URL is 404.
- It does not create the images in example.tld/kirby/media/pages/bob/ , new images don’t show up as images. The .jobs subfolders are created though and the …jpg.json files are generated.
- The previously uplaoded images still render, so apache is able to host the media-folder under that URL in general
It seems to not being able to run the jobs anymore to render the images over into media.
Help!
How to debug that?
(*) Why a subfolder for kirby?
I am aware of the argument “there is no reason to put kirby into a subfolder”.
Our reason is that we have an existing homepage, say example.tld, with an existing php CMS. The existing CMS lives in folder example.tld/cms/ but through example.tld/.htaccess rules it renders pages such as example.tld/alice . We use Apache to handle 404s, so there is no catchall-rule in the htaccess. By adding kirby to the existing htaccess to the end, it catches what is not rendered by the existing cms. We also have other tools in other subfolders of the main folder. We use apache. This worked for a decade. We run a business, so we want to keep our cool uris and not break a running system we depend on for our business.