I apologise that its only in czech language but this is a really popular provider in czech republic so i think it might be helpful if this gets solved also for other people having the same problem in the future.
Basically if I login to FTP I need to upload all the files into a folder www/domains/mydomain.com/ and it shows up at mydomain.com publicly. This is where i put all the kirby files.
The website shows at mydomain.com but all the links point to mydomain.com/domains/mydomain.com/link
For example $site->homepage()->url() points to mydomain.com/domains/mydomain.com
Panel can be found at mydomain.com/domains/mydomain.com/panel
Content page at mydomain.com/domains/mydomain.com/my-content-page
and so on.
The website is not broken and everything works as it should, just all the links are ugly.
I tried to change the rewrite base in kirby’s .htacess file to / or /domains/mydomain.com but without any success.
The only thing that worked was setting c::set('url', 'http://mydomain.com');
It fixed all the links but now the panel is not reachable, both mydomain.com/panel or mydomain.com/domains/mydomain.com/panel say Invalid panel URL.
Im not using multiple domains right now but i cant guarantuee it will not be the case in the future. Also im not a big expert in .htaccess syntax so i dont know if it can be assigned somehow differently. The actual file used by the hosting is attached in the link in the first post.
And the error page appears before logging in. Even if i add manually /login to the url the error is still there.
In case anyone finds themselves in the same situation. I browsed the source code of kirby and realized $_SERVER[“SCRIPT_NAME”] is actually used in many places and I wasn’t able to identify where exactly to change it. So in the end I changed it to not include the domains folder path before even launching Kirby and it seems like it fixed my issue without breaking anything (panel and urls work the way you expect)!