After migrating WordPress to a new server, you sometimes see a 404 error message on pages that previously worked fine. This is almost always because the permalink structure or the .htaccess file was not carried over correctly, or because the database still refers to the old environment. By resaving the permalinks, restoring the .htaccess file, and checking the database URLs, the problem is usually resolved within a few minutes.
Why a 404 error occurs after migration
WordPress builds the URL structure of pages and posts based on settings stored in the database and based on rewrite rules in the .htaccess file. During a migration, the .htaccess file is often not transferred, or the new server uses a different configuration so that those rules no longer work. In addition, the siteURL in the database may still point to the old location, causing internal links to be built incorrectly. The result is that the homepage usually still works fine, but individual pages, posts, or categories return a 404.
Fixing permalinks
The fastest and most common solution is to resave the permalink settings. WordPress then automatically writes the correct rewrite rules to the .htaccess file.
Log in to the WordPress dashboard
Go to Settings > Permalinks.
Select the same structure again
You don’t need to change anything, simply select the setting that is already active.
Click ‘Save Changes’
This makes WordPress rewrite the .htaccess file, provided it is writable.
Test a few pages
Open a post and a category to check whether the 404 has disappeared.
Checking and adjusting .htaccess
If resaving permalinks doesn’t work, the .htaccess file may be damaged, empty, or missing the correct permissions. Open the file via the file manager in Plesk and check whether it starts with # BEGIN WordPress and ends with # END WordPress, with the standard WordPress rewrite rules in between. If this is completely missing, paste the default rules back in and save the file. Also check that the file isn’t accidentally set to read-only; in Plesk you can easily adjust file permissions via the file manager.
If your site runs on a server without Apache, such as a LiteSpeed environment, .htaccess is usually interpreted correctly automatically, but it’s still wise to check whether the correct module is active. If you’re unsure about the server configuration, contact your hosting provider’s support.
Checking database and URLs
Sometimes the cause lies deeper: the siteurl and home fields in the wp_options table still point to the old domain or an old subfolder. You can check this via phpMyAdmin, accessible from Plesk. Find the row with option_name ‘siteurl’ and ‘home’ and compare the value to the current domain. If it doesn’t match, update the value to the correct URL including https://.
Also watch for references within the content itself, such as images or internal links that still point to the old domain. A search-and-replace plugin can correct this all at once without you having to manually go through every post.
If you want to prevent migration issues in the future, consider working with a provider that assists with migrations. When switching to Tandata, the environment is carefully transferred, including the database and file structure. In addition, every web hosting package includes Plesk, where you can easily find the file manager and phpMyAdmin to quickly perform these kinds of checks.
Frequently Asked Questions
Why does only my homepage work?
The homepage doesn’t use rewrite rules from .htaccess, but individual pages and posts do. That’s why the problem often only becomes noticeable on other pages.
Do I need to reinstall plugins after migration?
Conclusion
A 404 error after migration is usually resolved by resaving permalinks, checking the .htaccess file, and verifying the database URLs. If you’d prefer to work structurally with a stable hosting environment with correctly configured servers, take a look at the options.