If you have moved your WordPress blog or website and found that the permalinks are not working again, then, don’t worry. That’s one of the most common problems when moving a WordPress blog to a new server, or even, to another web hosting provider.
It happens also when re-installing WordPress. You will notice that all your old posts redirect to 404 not found page errors.
In other cases, these posts will get an id instead of their post name, That’s a natural problem because your new server needs to rewrite the rules to execute your permalinks. Today, I will show you how to fix the WordPress permalinks after migration.
Before everything, please makes sure that you can log in to cPanel and edit the files. In general, web hosting companies allow that. In the end, you need to edit your website files if something wrong happens. In other cases, hosting providers can limit the access for some security reasons, so, you can log in, but, you can’t edit the file permissions, for example, and you need to contact the company to correct that issue.
To fix the broken permalinks problem, you need to login to the WordPress admin (dashboard), and reset your permalinks by just clicking on ”Settings”, then, ”Permalinks”.
Then, select your old permalinks setting, in general, it’s recommended to use “post-name” for blogs, and “day and name” for news and magazine websites. This is not a rule, but, remember that you have to save the same link structure for your blog.
If you add the ”category name” to your post link, for example, and want to change that later, you will lose your rank and this is what you don’t need in any case. So, use post name, it is clean and SEO friendly for search engines, but also, that looks easy and clean for people.
After selecting the right option, click on Save Changes button.
That’s how to change permalinks in WordPress. Now, your permalinks will work again after rewriting the WordPress engine automatically. You need to refresh your browser, and then, visit one of your old posts to verify if your permalinks work again.
If your server doesn’t allow to rewrite the rules automatically for security reasons, all you have to do is to add the below code in your Htaccess file. That will rewrite the WordPress engine manually to reset all your WordPress permalinks. It will show you the same URL structure exactly as the one that you’ve previously selected from the dashboard.
At the same time, you will get the latest permalinks that you’ve used before the error appears.
If you don’t have an idea on how to do that, log into cPanel, and locate your ”file manager” to open it.
You will get all your blog root files, search for ”.htaccess” as the blow screenshot example.
Click on ”.htaccess”, then click “Edit File” at the top right of the page. Next, add the code at the bottom of the ”.htaccess” file, and click ”save changes”. If you only can access your site with FTP, then, read how to use Filezilla with WordPress.
Refresh your browser, and verify your blog permalinks. Usually, all your posts will work correctly, but, if you’re using a CDN service, you need to wait some minutes. It happens sometimes that your CDN will continue serving the old pages, and take some time to refresh the new link structure. Or, you can manually purge the cache from your account, or, from the caching plugin if you have one.
If with all the above solutions, you sill have broken WordPress permalinks with 404 not found pages, then, be sure that you have a problem. In that case, you need to contact your hosting company and explain that you’ve tried all the permalinks rest solutions.
Many low qualities hosting providers hosts site in poorly configured servers, and that’s why I always recommend to go premium and host your site with WP Engine. It’s the best-managed and the fastest WordPress hosting provider, you will forget errors and problems. Best of all, the site super site speed and loading time will help ranking better in Google.