Recently, I created a WordPress Multisite installation on Amazon AWS Lightsail. I had this bizarre issue where my child sites were working, but whenever I would try creating posts or pages, the new button would take me to the root domain. Chalk this one up to stupidity (on my part).
It was a perplexing issue because it was acting like I was in the admin panel for the root domain, not the child site. It was even showing my post counts for the root domain (but not posts). Going to the permalinks screen was showing the root domina, everything was a disaster.
I could not work out what was going on. I debugged my .htaccess, and to an extent, my wp-config.php file. Nothing seemed to fix the issue. The one thing I could see was disabling my theme fixed the problem.
I realise this is quite specific, but I was calling switch_to_blog(1) inside a function call. The rookie error I made was forgetting to call restore_current_blog at the end of the function. This straightforward mistake caused an issue so significant. I pulled apart half of my site, trying to fix it.
So, the moral of the story is, if you’re having Multisite domain issues and you’ve checked your .htaccess and wp-config.php are not the culprit, this might be an avenue to explore.