1

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?

2 Answers 2

1

Try to change the primary field, from 0 to 1, in the craft_sites DB table.

1

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);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy