How to Install Kirby 3 Above Web Root

I can’t seem to get Kirby 3 to install above web root. What am I doing wrong as it won’t even let me to main panel page?

CloudApp

Looks like your haven’t moved the session, cache and accounts folders into the /storage subfolder.

Please always post code as code, not as screenshots. Thank you.

I am close. Just can’t get /panel to load?

<?php

class LocalValetDriver extends ValetDriver
{
    /**
     * Determine if the driver serves the request.
     *
     * @param  string  $sitePath
     * @param  string  $siteName
     * @param  string  $uri
     * @return bool
     */
    public function serves($sitePath, $siteName, $uri)
    {
        // if (file_exists($sitePath.'/file-that-identifies-my-framework')) {
        //     return true;
        // }

        return true;
    }

    /**
     * Determine if the incoming request is for a static file.
     *
     * @param  string  $sitePath
     * @param  string  $siteName
     * @param  string  $uri
     * @return string|false
     */
    public function isStaticFile($sitePath, $siteName, $uri)
    {
        if (file_exists($staticFilePath = $sitePath.'/public_html/'.$uri)) {
            return $staticFilePath;
        }

        return false;
    }

    /**
     * Get the fully resolved path to the application's front controller.
     *
     * @param  string  $sitePath
     * @param  string  $siteName
     * @param  string  $uri
     * @return string
     */
    public function frontControllerPath($sitePath, $siteName, $uri)
    {
        if (strpos($uri,'/panel') === 0) {
            return $sitePath.'/public_html/index.php/panel';
        }
        return $sitePath.'/public_html/index.php';
    }
}

I am just trying to keep Kirby folders above web root. Using Laravel Valet. Should be easy I thought. Kirby works fine having all folders in public root, but that is not good security. Anyone have this working with Valet?

Can Kirby even be installed in a “public” folder while keeping the important folders above web root with Laravel Valet? I seem to recall an open pull request for this.

True, but on shared hosting, you usually don’t have a chance to put stuff outside the web root.

Yes, it works with Laravel Valet. I had the same problem a while ago. The “trick” here is to go into the public folder and use the link command (not fiddling with the driver).

valet link foldername

Thanks so much. Works perfect!