Panel not working in multi-site setup

Hi :wave:

The panel won’t show on my multi-site setup. I get these error messages in the console:

Access to script at ‘http://localhost/media/localhost/panel/99a345cdf5e5dc02cf40bb11746da4ae/js/vendor.js’ from origin ‘http://localhost:9000’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.

I created a multi-site setup using the cookbook Using Kirby for multiple sites | Kirby CMS
with Kirby version 3.6.2 and it runs locally via iOS PHP-Server.
Apart from the fact that the images are not properly routing yet, the setup works with this code:


require 'kirby/bootstrap.php';

$sites = [
    'localhost' => 'localhost',
    'subdomain-1' => 'subdomain-1',
    'subdomain-2' => 'subdomain-2',

$host = Url::host();
$url  = 'http://' . $host;

if (in_array($host, $sites) === false) {
    die('Multi-Site not found');

$root = $sites[$host];

$kirby = new Kirby([
    'roots' => [
        'index'   => __DIR__,
        'site'    => $root . '/site',
        'content' => $root . '/content',
        'media'   => __DIR__ . '/media/' . $host,
        'assets'  => $root . '/assets',
        'config'  => $root . '/site/config'
    'urls' => [
        'media'  => $url . '/media/' . $host,
        'assets' => $url . '/' . $root . '/assets',

echo $kirby->render();

The media folder is created automatically and looks like this:

What am i missing here?
Thank you in advance!

Look to me as if you had to add the port to the media and asset URLs, otherwise you end up with different origins. You wouldn’t have this problem if you use URLs without ports.

Seems to me you have Access-Control-Allow-Origin: present, but not for localhost?

Thanks, it worked!! :raised_hands:

Well, it works on localhost now, but not on the live server.
Actually none of the links are working on the live server.

The images won’t show either. While the paths seem to be correct, no images are generated in the media folder (only the folder structure).

I tried the

RewriteBase /

Option in the htaccess file, but to no avail.
Right now i am clueless as to where the problem might be.

With none of the links you probably mean subpages, files and the Panel.

Is mod_rewrite actually enabled on the server? Or more basically, is the .htaccess even used? And is your server an Apache server?

I guess it’s time for the weekend :expressionless:
Putting the htaccess in the correct folder solved it all :sweat_smile:

Thank you very much and have a nice weekend!