How is $site->url() generated?

When set up in a subfolder in my host, $site->url() apparently returns https://mysite.com/starterkit when I’m not logged in, and https://mysite.com when I am (and break assets and links and prevent me from seeing the admin panel).

How is this value generated? I am trying to hone in on the server variable or logic that’s generating the errant value so I can fix it.

If you look up the method in the reference, there’s a link to the source code.

I haven’t done much modern PHP development.

I tried to follow the source code to here which mentions baseUrl().

However baseUrl() appears to be calling Url(), which in turn calls urls(__get('index'))

But then we’re back to square one.

I’m running around in circles…

In any case, you can set the url option in your config.php

I don’t know why Kirby should return a different url based on whether the user is logged in or not, unless you have some route in place or some plugin does something.

The problem is manually setting base url doesn’t work.

I have my config.php set to 'url' => '/_dev/starterkit'

home.css is broken as it’s trying to look for Request URL: https://my site.com/_dev/starterkit/_dev/starterkit/assets/css/templates/home.css.

Can’t log into panel as it give me JSON parsing error, which I suspect is also caused by the base url somehow doubled up somewhere.

I know it has to do with my hosting setup because my previous host is fine, which is why I’m trying to troubleshoot it myself since my hosting support is telling me go to the CMS support while Kirby works fine for everyone else and my own previous host.

This should be a url like http(s)://mydomain.com/starterkit or something like that, not a path.

I think something is seriously wrong with my hosting (NFSN), the starterkit is now working without special config.php base URL setting, and I haven’t done anything.

I’m giving up trying to fix this.