How to change permalink structure without losing traffic?

  • Post category:WordPress
  • Post author:
  • Post last modified:November 15, 2020
  • Reading time:6 mins read

Changing the permalink structure for your WordPress website? You must take care of the old links, otherwise, it will cause negative effects on the SEO as well as the traffic. Because the old links will redirect to a 404 page.

This article will cover how to change the WordPress permalink structure without losing any of your traffic and the SEO will be taken care of.

  1. The current permalink contains dates, and you want to remove the date from the permalinks and want a clear link structure, like the graphic below.
permalink structure from date to sample post
  1. Your website is associated with default WordPress permalink structure and you have not noticed it before and want to change it now to a simple and clear permalink structure like the graphic below.
permalink structure from categoryauthor to sample post
  1. Or any other permalink structure your WordPress website currently has and you want to change it to a clean structure you want.

Here is how to change the WordPress permalink structure without breaking SEO and losing any traffic. This method will redirect the old URL to new URL. How to do this?

For this, you need a redirect plugin like Redirection or you can use the redirection option from your SEO plugin (if your SEO has redirection option). If you are using Rank Math SEO plugin, you have to turn it on(if it is not turned on). You can do this by going to the Rank Math Dashboard and simply turn on the redirection option. See the graphic below for reference.

Turn on redirection on Rank Math SEO plugin

If you are using another Yoast SEO plugin, you will find the option under the plugin settings. I will do the redirection process with the Redirection plugin for this article. But the method is the same for the other plugins(Rank Math, Yoast SEO).

I will discuss two permalink structures here, one is from permalinks with the date to a clean structure and another is from a random permalink structure to a clean structure.

If you have the same permalinks for your website, you can just paste the codes to the redirection plugin and save it. It will work fine, otherwise, you can read the whole process, I have explained clearly so that you can learn the complete thing to do it your own.

CASE -1

Assuming the current permalink structure is in format like

example.com/2020/06/05/sample-post/

And you want to change it to

example.com/sample-post/

You can redirect the old URLs by simply using the Regular Expression(RegEx) on the redirection plugin, like the graphic below…

regular Expression redirection from date to sample post

So, how this works? Let’s break down the code to a human-understandable language. The code on the source target is …

^/[0-9]{4}\/[0-9]{2}\/[0-9]{2}\/(.*?)
  1. ^/‘ – This represents the domain like example.com/
  2. [0-9]{4}\/ – This represents the first four numbers, in this case, the year value in the permalink 2020/.
  3. [0-9]{2}\/ – This represents the month value in the permalink structure 06/
  4. [0-9]{2}\/ – This represents the date value in the permalink structure 05/
  5. (.*?) – This represents the sample-post . It captures the whole post-name to a group. You need this group to redirect the old links to the new structure.

For the target URL, you just need the group(sample-post) to be redirected to. In this case, we have only one group, so this group will be represented with $1. if we had more than one group than we should have to specify the exact group number( See case-2).

So, on the target URL just specify the group /$1. All the old links with the old URL structure with the date will now be redirected to the new URL structure.

In this process your website traffic will be redirected and you will not break the SEO.


CASE -2

Assuming the current permalink structure is like

example.com/category/author/sample-post/

And you want to change it to

example.com/sample-post/

You need to add regular expression on the redirection plugin as the image below. And read below for the explanation.

regular Expression redirection from categoy author to sample post

So, how this works? Let’s break down the code to a human-understandable language. The source URL code is …

^/(.*?)\/(.*?)\/(.*?)\

Let’s break the code, so that we can understand it.

Here the source URL contains three groups (.*?). One is for Category, second is for the author and third is for the post name. The groups are separated by a forward slash(/).

And on the target URL, we only need the third group in this case. So the target URL is containing only the /$3


SEE: How to display different sidebars on different posts and pages?

FREQUENTLY ASKED QUESTIONS

How do I change the permalink on my WordPress site?

To change permalink go to Settings -> Permalinks and select the permalinks structure you want. You can select the custom permalink structure as per your requirement.

What happens if I change my permalink structure?

When you will change the permalink structure, the old links will break and not able to load a page or post. It will give a 404 error. For this, you need to set up redirection rules for the old URL structure to the new URL structure.

Changing WordPress permalinks affects SEO?

If you can set up the redirection for the old URL structure to the new URL structure properly (this article contains it), you will not lose any traffic and the SEO will be maintained.

How to change permalinks in WordPress without breaking links?

You need to redirect the old URLs to the new URLs with the help of a plugin.

Do I need a plugin for redirection?

If you already have installed an SEO plugin like Rank Math or Yoast, you do not need another redirection plugin. These plugins already have the redirection modules. You just need to turn it on and set the redirection rules by following this article.

Final thoughts

Try to avoid changing the permalink structures more often. Because it can slow down the loading speed of the website if you frequently change the structure and create new redirection rule each time.

If you face any issue, you can contact me for help. I will love to hear from you.

For more regular expression validation you can visit this website.

TIP- For your WordPress website try to use less number of plugins and use the plugins which have more functionality instead of installing separate plugins for different functions. You can give a try to the Jetpack plugin, the plugin has some useful functionality which may be helpful for you. Read this article to know the usefulness of Jetpack before installing it.

This Post Has 2 Comments

  1. Duna

    Another reason for changing permalink could also be because you simply change title of your post?
    I currently use RANK MATH and I love it better than YEOST SEO 😉!
    Useful post thank you for the explanation.

    1. Nur Islam

      Permalink is different stuff, it is the structure of the URL, not the URL.
      And when you are changing the title of any post you should not change the URL. Because if you change the URL of a post the old URL(indexed by Google, shared on different platforms) will through the 404 page to the visitors. But, if the Redirection module is turned on Rank Math it will automatically redirect to the new URL.

Leave a Reply