How to fix the 404 error when doing a WordPress migration

A common error when performing a WordPress migration, whether from local to cloud, between servers, from one domain to a different one, is the 404 error.

This occurs when we have finished the migration, our home loads normally but when we browse the web, it gives us a 404 error, be it from a page, a post or a category.

This happens for several reasons, one of them is because we have not migrated the .htaccess file with the WordPress overwriting rules, another because the .htaccess has not been generated on the new server or because we have not saved the permanent links (permalinks ) on the new server.

The basic content of the WordPress .htaccess is as follows

Rules of overwriting in WordPress htaccess

If our WordPress does not have this file with this basic content and I say basic because the .htaccess can host many more functions, because normally when we try to navigate to any of our content, we come across a 404, content not found.

The solution

Once our migration is finished, one of the first things we have to do is go to Settings, Permalinks and save them. Automatically our WordPress will generate the .htaccess file with the mod_rewrite rules mentioned above and the problem is solved, all our internal links will work normally again.

Remember, whenever you do a migration, save the permanent links (Permalinks)

Another way to solve it is by creating the .htaccess file with the basic rules and it will have the same effect, but it is always advisable to save the permanent links again.

As you can see, the solution is very simple, but if you don’t know it, you can go crazy looking and fiddling around without knowing why it keeps giving you the 404 error.

With this mini tutorial you have the answer and the solution, it won’t happen to you again :).

Do you want your WordPress to be safe, fast and also hosted in Spain?

Well, you have it very easy, come with us, we take care of everything, we also give you a 15% discount forever, each year you will continue to have a 15% discount and the first year we register or transfer your domain for free and migrate your website so you don’t have to worry about anything.

15% dto hosting WordPress