Empty pages (only header and footer visible) after migrating

I have empty pages after migrating a website to another domain. Only header and footer are visible. Menu options all go to Homepage.

I did the normal procedure:
Empty cache
Copying entire website to new domain (also tried once with new MODX installation and copying only necessary folders)
Exporting-importing database
Updating all the paths and db settings
Rerun setup

Manager is working fine. I can see also the Homepage when I’m logged in in the Manager, but other pages are not accessible.

I guess it’s probaby a path that is not correct.

Try double-checking the paths in the following files:

config.core.php
core/config/config.inc.php
connectors/config.core.php
manager/config.core.php

Also - you didn’t mention the cache - so might be worth renaming your core/config/cache/ folder.

If you still have issues - check your installation folder and subfolders for files called error_log and check out any recent errors within them.

I did, all paths are correct. The site is functioning, except for the content that is not shown and only Homepage that is working.
Yes, cache is flushed as well.

There are dozens of errors like:
(ERROR @ /var/www/vhosts/site.nl/httpdocs/core/src/Revolution/modX.php : 783) PHP warning: foreach() argument must be of type array|object, null given
(ERROR in resource 1 @ /var/www/vhosts/ (ERROR @ /var/www/vhosts/site.nl/httpdocs/core/src/Revolution/modX.php : 783) PHP warning: foreach() argument must be of type array|object, null given
(ERROR in resource 1 @ /var/www/vhosts/site.nl/httpdocs/core/src/Revolution/modLinkTag.php : 108) Bad link tag [[~11]] encountered.nl/httpdocs/core/src/Revolution/modLinkTag.php : 108) Bad link tag [[~11]] encountered

Maybe try commenting out or renaming any htaccess files temporarily. And also maybe disable all plugins then switch back on one by one.

I am not sure where all those htaccess files are. I tried 2-3 of them without luck.

Disabling the extra’s doesn’t give any solution as well, except the site going 404.

I am pretty clueless at the moment. The site is working fine in the dev environment, so why not in the live environment?

Is your root .htaccess file present ok? Sometimes these are not copied successfully.

Are the PHP versions the same in your dev and live environments?

htaccess is same as in development site, PHP versions same as well.

The site itself is working; it’s just that the content is not loading. Header and footer are visible. Menu is not working as well. Pages except for Homepage are not accessible. Feels like a setting.

Have you tried incognito or private mode, to rule out browser cache and cookie issues?

Yes. Tried different browsers, providers, systems, incognito, etc. :frowning:
If anyone wants to help further I can give the URL of the live site.

Assuming that we have the same modX.php file (and I think we do), the problem is in a call to getParentIds() in the modX class. The error is thrown when trying to display the home page.

I’d guess that the MODX resource map ($this->resourcemap) has not been initialized properly at the time getParentIds() is called.

Do you have any plugins connected to front-end events like OnWebPagePrerender or OnLoadWebDocument?

Since the header and footer are rendering, I’d also take a look at the section of code in home page’s Template that contains the [[*content]] tag.

I disabled the extra’s one by one, but that didn’t give any result, except the site going 404 on some.

The site worked fine on the dev environment, which is the same host/server. So the only difference is the site_url.

I did find something peculiar: on re-enabling the extra’s one refused and gave the following error, which may be related:

Bezig met installeren van pakket: clientconfig-2.4.0-pl

PHP warning: Undefined array key “host”
PHP warning: fsockopen(): php_network_getaddresses: getaddrinfo for failed: Naam of dienst is niet bekend
PHP warning: fsockopen(): Unable to connect to :80 (php_network_getaddresses: getaddrinfo for failed: Naam of dienst is niet bekend)
Could not retrieve from clientconfig-2.4.0-pl.transport.zip?revolution_version=Revolution-3.0.4-pl
MODX could not download the file. You must enable allow_url_fopen, cURL or fsockopen to use remote transport packaging.

Are you disabling extras or plug-ins? You need to be disabling plug-ins.

Also, is the url correct in core/config/config.inc.php ?

yes, that url’s/paths are correct. The site is functioning fine, except the content won’t load.

What do you mean with plug-ins? I have never seen any plugin in MODX, only add-ons…

Deactivate a plug-in by clicking on it and then ‘Deactivate Plugin’ → Save

Did you, by chance, transfer the files to the new site individually with FTP? That often results in missing or corrupted files.

After doing some debugging on this site for Gerben, it appears to be an issue where the database wasn’t migrated fully. Somehow all indices and table metadata are missing.

I’ve asked Gerben to migrate the database again which will hopefully sort it all out as I did find other oddities related to it besides the issue here.

The thing that broke the context cache generation (no aliasMap or resourceMap) was the missing refresh_cache_idx index on the modx_site_content table. The resource cache generation forces mysql to use that index, which causes an error that did not get logged.

As a temp workaround, disabling the use_context_resource_table system setting avoids the index being forced. However, the lack of indices is causing all sorts of other issues too (like new database records being assigned ID 0, because the auto_increment primary key/index is missing) so the DB migration definitely needs to be redone.

3 Likes

The issue after migrating a website to another domain, with empty pages and menu options redirecting to the homepage, might be due to incorrect paths. Ensure you’ve updated all paths and database settings correctly during migration. Check if there are any absolute paths in the content that need adjustment

Mark did a great job in helpen me with this. All paths were updated correctly, but a missing part of the database.