Kirby installed in subfolder, removing foldername from URL breaks panel

I have a test Kirby install on my shared webhost, placed in a subfolder. I point my domain to the Kirby subfolder using an htaccess file in the root of the server. It looks like this:

RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST} ^(www\.)?mydomain\.com$ [NC]
RewriteRule ^(.*)$ mydomain/$1 [L]

Kirby detects my site URL as, so in the Kirby config file I added

c::set('url', ''); 

Finally in Kirby’s own htaccess file I uncommented line 17 and changed it to

RewriteBase /mydomain

Now the frontend of the site works as I intend it to, with clean URL’s (without /mydomain appended), but the panel returns a ‘file not found’ error. If I undo the change to config.php the panel works, but all URL’s have the folder name appended after the domain name (e.g., which I do not want. Did I miss a step or do something wrong?

Does your webhost allow to change the document root for your domain? I think it would be easier to set this to the /mydomain folder instead of rewriting everything!? Or am I missing something?

1 Like

I don’t think that would have worked because I’m hosting multiple websites on that server, one in the root and several in subfolders. However, your suggestion got me looking at the available cPanel options of my webhost again and I noticed that instead of parked domains I can also use addon domains, which allow a subfolder to be set as the root of that domain. Problem solved :wink:

How did you accomplish this in cPanel? I’ve attempted this but keep getting the error “You cannot park your main domain.” I would really like to solve the panel problem.

I did not use a parked domain but an addon domain in the end. Your error message seems to indicate that you are trying to add or park your main domain name (the one you used when signing up with your webhost). If that is what you are trying to accomplish, you need to ask your webhost to change your main domain to a fictional domain so that your real domain name becomes available to use as an addon domain).