A few weeks ago, I was working on a Magento 2 upgrade for a project that hosts multiple websites under a single Magento installation.

The upgrade itself went smoothly. Deployment completed successfully, Magento commands ran without errors, and our initial testing didn't reveal any major issues.

A little later, however, we discovered that the secondary website was redirecting to the default website.

What made this issue particularly interesting was that the root cause wasn't inside Magento at all.

Project Setup