If you know something about SEO, you probably already know what WordPress Permalinks are and the huge impact they have on your website visibility around the web. For this very reason, changing their structure is not a trivial task and shouldn't be underestimated by any webmaster or blog owner: not doing it properly will most likely result in broken links, 404 Page Not Found errors and other dreadful scenarios that will bring your SEO score down. In this post we will try to overcome these issues: however, before we do that, let's make sure we're all on the same track.
What are WordPress Permalinks
In the unlikely chance you don't know what we're talking about, Permalinks are the rightmost part of the URL which comes immediately after the domain name, that WordPress will use to point to a specific page, post or any other resource on your website. Just to make a quick example, this is this page's permalink (bold text only):
- https://www.ryadel.com/en/change-wordpress-permalinks-without-breaking-the-previous-ones-avoiding-404-http-errors
As we can see, the permalink structure of this website is rather easy. It only uses the localization (it for Italian, en for english and so on), followed by the url-friendly page/post title. The overall result is what we could definitely call a semantic URL, since it contains a lot of useful information regarding the content.
For more info regarding semantic URLs, permalink types on WordPress and how to properly implement them under web servers such as Apache and IIS, we strongly suggest to read the following article.
Changing the WordPress Permalink structure
Luckily enough there are two useful tools that will greatly help you in transitioning from an existing WordPress Permalink structure to another one, avoiding all the aforementioned issues that might occur. The first one is a WordPress plugin called Simple 301 Redirects, which doesn't require anything else; the second one is a simple web-based helper tool provided by Yoast (the authors of the Yoast SEO plugin), which requires a web server with a rewrite engine based upon a .htaccess file (Apache, IIS with the ISAPI Rewrite module or equivalent, & more).
Using Simple 301 Redirects
Once installed and activated, click to the Simple 301 Redirects link that will appear under the Settings area of your dashboard. We will access to a very simple configuration page with two fields, Request and Destination. All we have to do is to type our old WordPress Permalinks structure into the Request field and the new one into the Destination field, not including the domain name: the plugin will automatically handle everything else.
This clearly is the best option for those who aren't much into .htaccess files or for websites hosted on service providers who don't allow users to change it.
Using the Yoast Redirect Tool
This method can give us more control at the cost of an additional step to be performed manually. This is what we need to do:
- Go to this page.
- Insert the website base URL.
- Insert the subfolder where we installed WordPress into, assuming there's one: if we've installed WordPress in the root folder, we can just leave it blank.
- Select the old Permalink Structure used by our Website before the change.
- Copy the resulting one-line code and add it to the top of our website's .htaccess file.
This method might be the proper way to proceed for people who know how to use .htaccess files, as they could also modify, adapt or extend the resulting code to better suit their needs.
That's it: happy redirect!