How to change permalink structure without losing traffic?

  • Post category:WordPress
  • Post author:
  • Post last modified:September 27, 2022
  • Reading time:18 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.
  1. Your website is associated with the 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.
  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 the 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 a 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 turning on the redirection option. See the graphic below for reference.

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 describe two permalink structure switches here, one is from a permalink 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 it clearly so that you can learn the complete thing to do it on your own.

CASE -1

Assuming the current permalink structure is in a 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…

So, how does this work? Let’s break down the code into 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 of 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 then 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 expressions on the redirection plugin as in the image below. And read below for the explanation.

So, how does this work? Let’s break down the code into human-understandable language. The source URL code is …

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

Here the source URL contains three groups (.*?). One is for Category, the second is for the author and the 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


Redirection for Blogger to WordPress ( with .html at the URLs)

When you moved from Blogger to WordPress and want to change the permalink structure to the postname only follow the below steps:

Assuming your existing permalink structure on Blogger was:

yoursite.com/2021/07/05/sample-post.html

And you want the new structure to look like:

yoursite.com/sample-post/

Create your redirection with the following REGEX values:

Source URL:

^/[0-9]{4}\/[0-9]{2}\/[0-9]{2}\/(.*)\.(.*)

Target URL:

/$1
Redirection Setup For Blogger To Wordpress

Do not forget to change the permalink structure to the Post name.

ALSO, SEE:
How to Remove Shop/Product/Product-Category slug from WooCommerce URL?
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 the 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 change the permalink structure, the old links will break and not be 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 the description of 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 a new redirection rule each time.

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

If you want to learn more about Regular Expression you can visit this website.

TIP- For your WordPress website try to use fewer 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 that may be helpful for you. Read this article to learn more about Jetpack before installing it.

Nur Islam

This Post Has 6 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 redirect the visitors to the 404 page. But, if the Redirection module is turned on on the Rank Math, it will automatically redirect to the new URL.

  2. Witspot

    Contents on this website is always informative. You are the best.

  3. vikas

    this is not work for me because in my url .html uses in last so what to for this

  4. Krishna

    Thanks for providing such an helpful information with us your explanation really helped me

Leave a Reply