Well this is a super-niche issue that I came across today. I don’t have an answer – maybe you do?
I have a WP multisite running in sub-DIRECTORIES. And it has a domain alias pointing at it. There are some redirection plugins installed but these turned out to be irrelevant.
The domain alias was redirecting to the main domain BUT… it was stripping any path off. So:
was being redirected to:
Which was annoying because I wanted the path so I could do further redirects.
I experimented and eliminated the other redirection plugins as a cause.
And then I added some stuff to
wp-config.php to trap my requests. These WERE being triggered and so I eliminated the web server as a cause.
So I figured WordPress core was doing a redirect to the main domain without the URL.
There is a
maybe_redirect_404 function that seems to do the redirect I’m describing and runs in multisite IF a
NOBLOGREDIRECT constant is set. But this constant was NOT set.
I then tried trapping the request in a must-use plugin, figuring that this was the earliest I could load anything custom, but this code wasn’t being hit!
So this redirect was happening AFTER loading
wp-config.php but before mu-plugins are loaded.
It’s really odd. I’ve added the hacky fix of redirecting from
wp-config.php but I’m not very happy about doing so!
Does anyone with WP Multisite internals knowlegde know what’s going on here?