How to move content out of root folder?

Hiya,

I would like to move the content folder out of the root folder.

Any suggestions how to achieve that? Can it be done via the config file?

Thanks in advance,
Stephan

See Configuring Kirby | Kirby CMS

Cool!

Thanks a million for the prompt reply.

I will try it out later.

Thanks again,
Stephan

Sorry,

I followed the instructions, and changed the index.php to this:

$kirby = new Kirby([
    'roots' => [
        'index'   => __DIR__,
        'content' => __DIR__ . '../kirby_content'
    ]
]);

But that doesn’t work.

Is the syntax correct, if I want to have the content one level higher than the rest of the site?

Stephan

Should be

  'content' => __DIR__ . '/../kirby_content'

Thanks,

I just tried that, but that doesn’t work either.

But even when I try something simple as that:

<?php

require __DIR__ . '/kirby/bootstrap.php';

$kirby = new Kirby([
    'roots' => [
        'index'   => __DIR__,
        'content' => __DIR__ . '/data'
    ]
]);

echo (new Kirby)->render();

I get an error message

("Kirby\Exception\NotFoundException thrown with message “The home page does not exist”)

Any ideas?

All the best,
Stephan

You have to use the newly created variable here, not create a new instance!

echo $kirby->render();

Oops,

Now it works! I have to work on my copy & paste skills…

Thanks for the great support!
Stephan