I’ve been migration our modx package to a new provider. After changing all paths (hopefully) the site seems to work just fine again.
The only problem is the Snippet FirstChildRedirect which causes a blank page.
I could trace the error to the modx->sendRedirect which seems not to work. The url it takes as argument looks ok and is not different to our old environment.
Any ideas?
My current workaround is a javascript window.location.replace command but this just a bad workaround for sure.
That’s very weird. sendRedirect() is a widely use function of the MODX core.
When you open the developer tools in the browser and go to the “Network” tab, and then request the URL of the parent resource, can you see the “301 Moved Permanently” status response from the request in the list? With the correct redirect URL (response header “Location”)?
Did you try clearing the browser cache or using a different browser?
Maybe an old/wrong redirect is just cached in the cache of your browser.
Also, did you check the PHP error log (and maybe the MODX error log) to see if a (fatal) error occurs, when requesting the parent resource (with the “FirstChildRedirect” snippet call).
I’m having a similar issue after moving a MODX site to a new host (also using version 2.8.5). sendRedirect() doesn’t give any errors, but it just shows a blank page.
I checked the PHP logs like you suggested and found a “headers already sent” warning. In my case, it was caused by some extra spaces before the <?php tag in a snippet include. Once I removed those, the redirect started working again.
Might be something to look out for if anyone else runs into this.