How to Change Your Permalink Structure in WordPress Without Losing SEO

Hey Ashley!

I cringe whenever I see my URLs because they include the dates. I had moved from Blogger to WordPress, and I recall having to restructure my permalinks so that the redirection would be flawless. Is there a way to not use that (even with redirection enabled)? I prefer the look that your blog uses with just the post title. Thanks!


Hey Chrys! πŸ™‚

Just to backtrack a moment for anyone who doesn’t know: it’s really easy to change your permalinks in WordPress. You simply go to Settings » Permalinks and select a new option. The problem is that if you change your permalinks, your old URLs will break (in most cases.. it does depend on what format you were using. For example, the default one will always work). People will get 404 errors when trying to visit them.

The way around this is to change your permalinks and then redirect the old ones to the new ones. To do this properly, you will have to modify what’s called your .htaccess file. This will be located in the root of your WordPress installation (viewable through FTP access or your host’s “File Manager”). I recommend that you take a backup of your .htaccess file before making any edits so that you can restore it if you need to (incorrectly made edits to that file can result in the “white screen of death”.. or other errors).

Use this permalink helper tool by Yoast to generate the redirect code. Simply fill in the box with your site URL, select your old permalink structure, and press Generate Redirect. The next page will give you a put of code to paste into the top of your .htaccess file. It will look something like this:

RedirectMatch 301 ^/([0-9]{4})/([0-9]{2})/([0-9]{2})/(.*)$$4

This bit of code will redirect all URLs matching the old format to the post title format that I use!

In your case, there will technically be two redirects:

  • The redirect from to
  • The redirect on from the old structure to the new structure

It’s confusing, but theoretically it should work! πŸ™‚

Photo of Ashley
I'm a 30 year old California girl living in England (I fell in love with a Brit!). My three great passions are: books, coding, and fitness. more »

Don't miss my next post!

Sign up to get my blog posts sent directly to your inbox (plus exclusive store discounts!).

You might like these


  1. What if I wanted to redirect to a custom permalink structure like /%category%/%postname%/, is that possible with the permalink helper tool listed above?

  2. I’m working on this now and the redirect didn’t work. Any clue as to why? I switched my posts from year/month/date/postname to just /postname. Thank you!

        1. Well at least part of the problem is that your URLs don’t currently have /blog/ in them. For example, here’s a link to one of your blog posts: notice how there’s no /blog/ in there, so that shouldn’t be in the htaccess rules.

          (I don’t know if you USED to have /blog/ in the URL, but if not, you should remove it from the year/month/date/postname rule as well.)

  3. Thanks for this post! BUT I’m scared to make the change (such a nervous nelly). Where exactly should my redirect code go?

    This is what it looks like currently :

    # BEGIN WordPress

    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ – [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]

    # END WordPress

    Thanks so much for your response and help!

    Naomi recently posted: Why I choose Parenthood vs Scandal
      1. You’re awesome to be so quick to respond. I put it there … and then got this message when I tested :

        Error code: ERR_TOO_MANY_REDIRECTS

        Any ideas?

        1. Did you update your permalink structure within WordPress? And are you sure you pasted in the correct redirect code?

          Too many redirects could happen if, for example, you have your permalinks set to be “post name”, but then you tell it to redirect post name to post name… so it’s redirecting on itself.

      2. Hi,

        I really appreciate you helping everyone. For the same reason as Naomi, mine looks a bit different:

        #RewriteEngine On
        #RewriteBase /
        #RewriteRule ^index\.php$ – [L]
        #RewriteCond %{REQUEST_FILENAME} !-f
        #RewriteCond %{REQUEST_FILENAME} !-d
        #RewriteRule . /index.php [L]

        # BEGIN WordPress

        RewriteEngine On
        RewriteBase /
        RewriteRule ^index\.php$ – [L]
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule . /index.php [L]

        # END WordPress

        Should i pasted it above BEGIN wordpress or above # and with a # in front of it like this: #RedirectMatch 301 ^/([^/]+)/([^/]+)/$$2 or without?

        1. Hmm strange, there is some kind of code next to the first # that is not visible when i post the comment.

        2. Anything that is after a # sign is NOT doing anything. It’s the equivalent of a “comment” in HTML or CSS. It’s not actually being executed.

          You can paste it above # BEGIN WordPress but DO NOT add a # sign in front, or else it wont’ do anything.

            1. Hi,

              Something very strange now.

              When you visit my homepage and try to click on a post to open it, it does nothing?

              Do you know what that is?

              Best regards,

                1. Provided that the redirect is working (visit an old URL and see if it redirects to the new one) then you will not lose SEO rankings.

  4. what the tool can change the permalink from /% year% /% monthnum% /% postname%. html To /% year% /% monthnum% /% post_id% /% postname%. html ? Thanks πŸ˜€

  5. Great article! I know it’s a while since you published this post, but I’m taking a shot here and leaving a comment anyway.

    I want to change the permalink structure for my blog FROM TO

    In other words, I want to change the %category% value to traningsbloggen (which is the name of my blog page). How would the code I need to add in .htacess look? I’ve only managed to find examples of how to change to and not with the /traningsbloggen/ addition to the URL.

    Any help with this is much appreciated!

    (And thanks again for a very informative post, made everything with permalinks and .htacess a lot clearer!)

    / Ida

  6. Hi Ashley! I just stumbled across your excellent blog post, while trying to fix permalink on a blog that i recently migrated from blogger to wordpress, too. Just wondering which tool / fix / plugin would you recommend for blogger to wordpress redirection – i assume adding this code into the .htaccess file would only work after having set up redirection… ? Thanks!

  7. My current permalink structure is the wordpress default. I want to change to the post name. When I use the Yoast generator it says this: Your Redirects

    You don’t have to do any redirects, WordPress will do it for you.

    So I changed the permalink setting on the blog and got this message:
    StatPressCN info:Permalink structure has been set to /%postname%/.Updating URLes…

    ..but it doesn’t appear that anything is happening. No spinning cursor or anything. I’ve tried just letting it run but nothing changes. In the meantime I get a 404 error on all my blog posts. I can change it back to the default setting and it changes back immediately. I’ve let the Updating URLs notice stay up for up to 20 minutes and it never changes. Am I not being patient enough or is it not working?

    1. Ok, when I got tired of having the blog down, I set it back to the default setting and got this message.

      StatPressCN info:Permalink structure has been set to default.Updating URLes…

      WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘!”’ at line 1]
      SELECT id, ptype, pvalue, urlrequested FROM wp_statpress WHERE pvalue !”
      The permalink structure is set to default, 0 sets are updated done

      Warning: Cannot modify header information – headers already sent by (output started at /home/spiritbl/public_html/wp-content/plugins/statpresscn/statpresscn.php:3189) in /home/spiritbl/public_html/wp-includes/pluggable.php on line 1207

      Then I asked it again and it changed immediately back the default permalinks.

  8. Hello,

    I tried this tool, but the issue is i am not being able to access my wp-admin panel now. I have changed permalink structure from /%category%/%postname%.php to /%postname%/

    Now my admin panel isn’t accessible. Any help will be appreciated.

  9. HI Ashley,
    I am doing SEO for a client who recently had their website redesigned. Afterwards they took a major hit on the SEO side. So after getting access to their WordPress I discovered that all their URLs are set the default permalink. (which explains the SEO hit)
    Therefore, I want to change the permalink structure to postname. And understand that I need to do a 301 redirect from the old links (default permalink) to the new (postname)
    However, I do not have access the .htaccess file and have no experience with it.

    Do you have any suggestions? What should be my next course of action in changing the permalink without breaking the website. (The clients has a ton of backlinks)

    1. You shouldn’t need to set up redirects if you’re going from the default structure. That structure will always automatically redirect to the permalink setting you choose.

  10. WOWOWOWOWOW, finally, 4 hours im looking for this trick, and i found it here.
    i have tried so many plugin and so many methods. and here, its very easy. thanks a lot
    god bless u

      1. Hello Ashley,

        I am new on blog writing can you please have a video of this article, So, I able to understand better.

        Your work is going best for me.

  11. Thank you so much for this! It worked like a charm! I had been annoyed by this for a long time and thought there was nothing I could do so I really appreciate it.

Recent Posts

    Random Posts