Symlinked or alternate location for content folder

Hi, I am trying to implement a Kirby 3 installation that points to a content folder located in /home/user/Dropbox/content/ instead of /var/www/site-folder-with-kirby/content/

I’ve successfully added a symlink on the server (jfi-pw.partnerandpartners.com) but that presents issues with ongoing permissions and syncing.

I have unsuccessfully tried to do the following in a local instance within index.php:

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

$kirby = new Kirby([
    'roots' => [
        'content' => __DIR__ . '~/Dropbox\ \(Partner\ \&\ Partners\)/jfi-pw/content'
    ]
]);

echo $kirby->render();

and

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

$kirby = new Kirby([
    'roots' => [
        'content' => '/Users/username/Dropbox\ \(Partner\ \&\ Partners\)/jfi-pw/content'
    ]
]);

echo $kirby->render();

the debugging error that is consistently returned:

Kirby \ Exception \ NotFoundException (error.notFound)
The home page does not exist

Even though there is clearly a home page file. Any ideas?

I assume it means it doesn’t find the folder at all. What are the spaces and backslashes doing in your path, I suppose those are meant to be backslash escapes?

Yes, that’s technically the name of the Dropbox folder.

Maybe you can try with a clean folder name without parenthesis first to rule out any issues with those slashes and spaces.

Since it works if I put the content folder anywhere in my file system and provide the absolute path, the issue is very likely with that path name.

That worked! Thank you.

On the server, I had to remove the symlink to the content folder since Dropbox no longer follows the contents of symlinks and implemented the changes above to index.php instead.

However, a few other things needed to be done with the permissions in order to get the panel to work on the server, in addition to having local changes within the shared Dropbox folder successfully sync. I figured others might run into this issue so here’s what I did to get it to work:

  • Install and link a new Dropbox account on Linux

  • Change the permissions and ownership of the Dropbox folder to match the Kirby installation so that Kirby can both read and write to it:
    sudo chown -R user:www-data /home/user/Dropbox/
    sudo chmod -R 775 /home/user/Dropbox/

  • Adjust the apache settings so that it’s running as the same user
    sudo nano /etc/apache2/envvars

  • Restart apache
    sudo systemctl restart apache2