Base URL in config.php is printed twice when using css('@auto')

It looks like my new host - NearlyFreeSpeech - is causing Kirby to not properly detect the base URL when used in a subfolder.

I initially thought it was a mod_rewrite issue, but I think now it’s a base URL issue.

To troubleshoot, I tried to manually set the base URL in config.php to 'url' => '/starterkit'.

However, I get this in the home page source:

<!DOCTYPE html>
<html lang="en">
<head>

  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width,initial-scale=1.0">

    <title>Mægazine | Home</title>

    <link href="/starterkit/assets/css/prism.css" rel="stylesheet">
<link href="/starterkit/assets/css/lightbox.css" rel="stylesheet">
<link href="/starterkit/assets/css/index.css" rel="stylesheet">
<link href="/starterkit/starterkit/assets/css/templates/home.css" rel="stylesheet">
    <link rel="shortcut icon" type="image/x-icon" href="/starterkit/favicon.ico">
</head>

The base URL is generated twice for home.css, but not others.

In the header snippet, the URLs are generated by:

  <?= css([
    'assets/css/prism.css',
    'assets/css/lightbox.css',
    'assets/css/index.css',
    '@auto'
  ]) ?>

So whatever @auto is doing, it’s somehow printing the base URL twice.

I think you should set the rewrite base in the .htaccess. Maybe set it to / instead of /starterkit there. Alternatively, map a (sub)domain to that folder instead of using a subfolder in the url.