I have a multi-site setup and toggled the primary site inside settings -> sites to "off". So now I don't have any primary site anymore and I get an error preventing me from accessing my admin page saying: "craft\errors\SiteNotFoundException: No primary site exists in xyz". How can I redefine a primary site?
Try to change the
primary field, from
1, in the
craft_sites DB table.
This doesn't directly solve the OP's issue, but related:
$site = Craft::$app->sites->getSiteByHandle('mySite'); $site->primary = true; Craft::$app->sites->saveSite($site);