We are going to roll out an update to a large Kirby site and we’d like to provide our client with a private link to check all change before going live. Because the content and media folders are huge, I was asking myself, if it would be possible to reuse those folders from the production site.
Are they are on the same box? You could probably symlink the content folder from live to staging, but since the media folder is always in a state of flux, i think you should probably leave that alone.
You could also use rSync to transfer from one location to another directly which might take a while the first run but subsequent runs will be much quicker since only the changes get synced. You can do this by logging into the server via SSH and doing the sync from there. And since you are using your hosting providers super fast connection to do it, it should be really fast.
Other then that, yes, you are probably looking at a custom folder setup so that both sites read from the same place. I think you actually want four folders:
Linux has the really neat feature of being able to link a folder to a another location. The voodoo being is that as far as the operating system is concerned, that folder exisits where the sym link is, even tho its somewhere else entirely on the server. Its just a simple command. Google for “symbolic link”, and be sure of what you are doing first, but i repeat … this is the live content content folder so any changes made in dev will show up on live.
That sounds easier. How would I have to write that path though? I know __DIR__ but I need to go a folder up. Are relative notations valid? Like '../production/content'? Or is __DIR__ . '../production/content' possible?
Hm, I could only test this in my local environment and there I didn’t have to change anything .htaccess-wise. I always thought the rule only blocked accessing files in the content folder when trying to reach them via the browser, not programmatically on the same server. Long story short, I don’t have an answer at the moment.