Wordpress Permalinks

How To Safely Change WordPress Permalinks Structure

When we first start using WordPress, we unknowingly continue with the default permalinks which has day and name in them. As time passes, we realize the importance of having the SEO-Friendly URLs mostly  https://your-domain-name.com/post-name . The best part is WordPress offers the ability to change your permalinks to the desired structure at anytime.

If not done correctly, all the links will result into 404 Page Not Found error and cause a considerable traffic drop. But don’t worry, this guide will cover all the steps to change your permalink structure & also implement the redirections.

The Permalinks in WordPress means ‘Permanent Links’ meaning they are the permanent URLs to your posts, pages & archives.

A permalink is the web address used to link to your content.

wordpress.org

Slug is a part of your permalink. It is a text that comes after your domain name in the URL that identifies the respective page/post.

For example, the permalink of our first blog post is https://hostmy.blog/how-to-migrate-wordpress-http-to-https – comprises Domain Name: hostmy.blog & Slug: how-to-migrate-wordpress-http-to-https

How To Update WordPress Permalinks & Redirect?

  1. Understanding 301, 410 & Handling 404 Errors
  2. How to Change Permalink Structure
  3. Redirecting to New URL Structure using Regex Method
  4. Bonus Tip – Sites Migrated from Blogger Platform & Social Sharing

Understanding 301 & 410

Before we dive further into changing the permalinks, it is important to understand the redirections. In this guide we will only cover 301 & 410 codes. Both can tackle the 404 errors accordingly.

301 Redirect – Moved Permanently

Using 301 redirect we can redirect the users visiting Old URL to its respective New URL and also hint the search engines that Old URL content has permanently moved to New URL. You can use this method to redirect 404 errors to the relevant page/post or the homepage.

410 – Gone

Sometimes we prefer telling the visitors and search engines that we have deleted this page with no forwarding address. Search engines then gradually delete the page from the index. 410 is all that we need to hint the search engines that we have deleted the page & there is no relevant page/post.

Handling 404 – Not Found

404s are the broken links. The chances are you have deleted the page or updated the slug and did not add redirection. You can deal with 404 errors either by creating redirects or setting up a custom 404 Page with alternative information for the visitors. If you leave it broken, you will send negative signals to your visitors & search engines.

Steps to add 301 and 410 Redirects

  1. Install & Activate Redirection Plugin
  2. Go to Tools – Redirection & finish the initial setup
  3. For 301 Redirect: Add New -> Source URL (old broken link) | Target URL (new relevant link) -> Add Redirect

    wordpress permalinks

  4. For 410 Redirect: Add New -> Source URL (old broken link) -> Click on Settings Icon -> When matched [from drop-down list select Error 404] -> with HTTP code [from drop-down list select 410 Gone] -> Add Redirect

    wordpress permalinks

Now that you understand the basic of redirect codes & how to create redirection lets move to the big change on your site – Changing Permalink Structure.

To my experience you will either deal with default permalinks which has day and name in them or permalinks which has day and name but ends with .html. The latter is common if you have migrated from Blogger platform.

I have a Bonus Tip to handle permalinks that ends with .html

Before we update the permalink structure – I recommend you check if your site properly migrated to HTTPS.

You can follow our HTTP to HTTPS Migration Guide.

Updating WordPress Permalinks

Go to Dashboard -> Settings -> Permalinks -> Select Post Name Structure -> Save Changes

wordpress permalinks

Redirecting to New URL Structure using Regex Method

Once you update the permalink structure – the next immediate step is to create redirection. This redirect differs from the one-to-one redirect. We will use regex method to redirect old URL structure to the new one.

Follow the below steps

  1. Open Yoast Permalink Helper
  2. Put URL of your site -> Select your old permalink structure -> Generate Redirect

    wordpress permalinks

  3. Once you generate the redirect – it will appear at the top

    wordpress permalinks

  4. We will delete RedirectMatch 301 and divide the above generated rule into 2 parts – Source & Target, which we will put into Redirection Plugin accordingly.

    Source: ^/([0-9]{4})/([0-9]{2})/([0-9]{2})/(?!page/)(.+)$

    Target: https://your-domain-name.com/$4

  5. Go to Tools -> Redirection -> Add New -> Source URL ^/([0-9]{4})/([0-9]{2})/([0-9]{2})/(?!page/)(.+)$ -> URL options will be REGEX -> Target URL https://your-domain-name/$4 -> Add Redirect

    wordpress permalinks

Please make sure you are generating rule for your domain name. I have used my domain name only for the example.

Alternatively, you can add the regex redirection rule directly into your .htaccess file. But I recommend the Redirection Plugin to manage all your Redirections.

Bonus Tip

Migrated from Blogger to Self-Hosted WordPress

I have noticed the blogs migrated from Blogger Platform are setup with Custom URL Structure with .html. For e.g. https://your-domain-name.com/yyyy/mm/post-name.html

If this structure sounds familiar, then we need to tweak the redirect rule. Assuming that you will switch to Post Name structure – follow the below steps.

  1. All the steps mention above will remain the same. The only change will be your old permalink structure.
  2. Open Yoast Permalink Helper
  3. Put URL of your site -> Select Custom as Your old permalink structure [ /%year%/%monthnum%/%postname%.html] -> Generate Redirect
  4. The redirect rule with now appear with .html

    wordpress permalinks

  5. Now your Source & Target will be:

    Source: ^/([0-9]{4})/([0-9]{2})/([^/]+).html$

    Target: https://your-domain-name.com/$3

Social Shares Recovery

If you are using social sharing feature on your blog, then you will need to recover the data when you update your permalink and/or migrate to HTTPS. The social share recovery feature is usually comes with the premium plugins like Social Warfare.

Wrapping Up

Changing permalink structure to post name will make it more user & bot friendly. It will help with your SEO efforts too. But as I mentioned – it is a critical process, so be cautious & follow all the steps carefully.

I always recommend keeping a backup before you try anything major on your site.

I hope you find this guide helpful. If you have any questions or suggestions, leave a comment below and I will do my best to help you out. Also, let me know how you like this guide – I would love to hear your thoughts and experiences.

Professional Assistance

Does this intimidate you? We got your back. We offer this service to our customers.

Hire Us

Scroll to Top