Problem with using Kirby in a /public/ folder

Hi,

I’m having this stupid problem on some shared hosting and can’t seem to get my head around it.

I always use kirby with a /public/ folder setup which never is a problem if you set the documentroot to /public/. With this specific site I change the documentroot so I used a .htaccess to rewrite to the public

so in my / I have a .htaccess to rewrite to /public/

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>

That all works find but the links that are generated by Kirby still contain /public/ in them :thinking: So homepage etc… all works perfectly but as soon as you click on a link you have /public/ in the url. If I remove the /public/ the url still works (hence the .htaccess is doing it’s job but it’s just Kirby that keeps generating the /public/ urls from the pagelinks…

Any ideas out there to fix this? :grimacing:

Cheers!

Sam

If I understand correct, you have set the DocRoot to /somepath/ while the root of the Kirby installation is at /somepath/public/. The .htaccess in /somepath/ is posted above but how does the .htaccess in /somepath/public/ looks like? And what does the config.php contain?

.htaccess in the /public/ is the standard Kirby .htaccess and index doesn’t really contain anything special except for code to fix the new roots. Config doesn’t contain anything.

$rootFolder = dirname(__DIR__);
$storageFolder = "{$rootFolder}/storage";

$kirby = new Kirby([
    'roots' => [
        'index'    => __DIR__,
        'base'     => __DIR__,
        'site'     => "{$rootFolder}/site",
        'storage'  => "{$storageFolder}",
        'content'  => "{$storageFolder}/content",
        'accounts' => "{$storageFolder}/site/accounts",
        'cache'    => "{$storageFolder}/site/cache",
        'media'    => "{$storageFolder}/media",
        'sessions' => "{$storageFolder}/site/sessions",
    ]
]);