Manage your links in WordPress

How to Change your Permalink Structure Without Breaking your Links

| 63 Comments

Permalinks are the part of each web address that comes after the domain name, pointing to a specific article on that website and they serve a few purposes:

  • When correctly composed, they give people an idea of what your article is about, just by seeing the article title in the web address.
  • They do the same for search engines, helping them to ascertain the topic of a page just by reading the URL.
  • Lastly, they provide a permanent location, which people and search engines rely on to be able to find your content easily.

In that sense, permalinks are like your postal address: they’re a unique marker that is permanently tied to each of your articles.

In the same way that you sometimes move house, you may want or need to change your permalink structure. The most likely reason is that you started using the default WordPress permalink structure and now want to tweak it.

To carry on the parallel, when you move house, you need to let people know so that they know where to find you and send mail. The same is true when you change your permalink structure – you need to let your readers and search engines know where you’ve moved your articles to.

Default and common permalink structures

The default permalink structure that WordPress uses is

where 123 is the post ID. This isn’t really advisable, because neither search engines, nor people get any clue of what the article is about until they open it.

Under the Settings > Permalinks menu, WordPress also offers up some other permalink structures that you can choose from, including

and

which include the date, so that readers can get an idea of how old the article is from the URL. On websites where current topics are the focus, this may prove more useful.

In my opinion however, sites like mine, where the information is more ‘timeless’, having the date in the URL is not really worthwhile, so my preferred format is

The syntax for this permalink structure is:

However, you don’t want to change your permalink structure before you’ve made sure that you set up the redirects, so that anyone going to your old addresses is forwarded to your new addresses. It’s like telling the Post Office to forward your mail to your new address when you move house.

How to redirect traffic

There are a few different ways that you can redirect traffic. However, the cleanest way to do it is by setting up a 301 redirect, which serves two functions:

  • It forwards users who enter the old address to the new address, and
  • It tells search engines and browsers that visit the old address that the article has permanently moved to the new address, so that they can update their indexes and bookmarks automatically.

This way, search engines will automatically update the addresses of all your pages that they have indexed, so you’re not losing any headway with the search engines.

Setting up the redirects

There is an excellent plugin called Advanced Permalinks that handles all of this work for you behind-the-scenes. Once you’ve installed it, the set-up is so easy that you’ll be wondering whether it has been done correctly.
Migrating your Old Permalinks to your New Permalinks

  1. Under the Settings menu, select the Permalinks section. You’ll see that there are four new tabs at the top of the page (Advanced, Posts, Migration and Debug).
  2. Make note of your existing permalink structure – this will be shown in the text box next to the custom option, even if you’ve selected one of the preset options. Copy this syntax as you’ll need it in the next step. If you’re using the default permalink structure, it won’t show up, but the syntax is /?p=%post_id%/
  3. Now head over to the Migration tab – this will allow you to specify any number of old permalink structures (you can change your permalink structure as many times as you like, but I don’t recommend this). Paste the syntax from the previous step into the text box called ‘Old Permalink’ and hit ‘Add’.
  4. Now you’re free to change your permalink structure to your new structure on the Defaults tab. The plugin will create a dynamic 301 redirect, that redirects traffic arriving at any of the old syntaxes to the current permalink structure, whatever it may be.

That’s it! It’s probably wise to submit your site to search engines to be crawled as soon as possible so that they get your updated permalink structure ASAP.

Moving to a new domain as well

If you’re moving your WordPress site to a new domain and want to change your permalink structure at the same time to get a fresh start, you’ll want to follow the above instructions on your new installation. As for the old installation, you’ll want to follow my guide for ‘Moving your WordPress site to a New Domain Seamlessly‘, paying particular attention to step 9, which creates a redirect from your old site to your new site.

If you then follow the 4 steps above on your new site, you’ll essentially be creating two redirects: anyone arriving at your old site will be redirected to the same permalink structure on your new site. However, Advanced Permalinks on your new site will redirect you from the old permalink structure to the new permalink structure. And it will do all of this before you can bat an eye.

Have you given this a go? What was the reason that you changed your permalink structure?

Categories: Plugins | Permalink

What next?

Hire me

If you couldn't quite manage this yourself, find it too intimidating, or just don't have the time to do it, you can always hire Dave to do it. Please get in touch so that we can discuss your needs.

Leave a comment

If you have a question, update, or comment about the tutorial, please leave a comment. I try and respond to every comment, though it may take a few days, so please check back soon.

Let a WordPress Expert help you

Do you want to try this, but feel like you need a helping hand, in case something goes wrong? My service, The WP Butler, gives you access to WordPress expertise whenever you need it. Better yet, I'll keep your site backed up, updated and secure, so that you don't have to worry about it. It's all part of the service. Use coupon DIWW and save 15% on all plans.

Visit The WP Butler

Author:

Dave has been tinkering with WordPress for many years, and he now shares his WordPress knowledge here on Do It WIth WordPress to help others realise its impressive power. He can also be hired to help with your WordPress needs. Dave, who is British, is married to his best friend, Marti, with whom he has a beautiful daughter, Ellie. When he's not dabbling with WordPress, he's probably eating Triscuits or hummus, watching an indie film or British TV show, spending time with friends or family, or exploring the world.

63 Comments

  1. I just have plan to change my permalink instruction but worry about the effective of SEO. Thank you for your tips that help !

  2. Thank you for your suggestion. I will make a change for now.

  3. Is it possible to change a permalink but transfer the number of Facebook “Likes” it has received? Thanks.

  4. Hey Dave! Just getting back to your site to get some more well written instructions. I may have mentioned this: Yours is the best technical writing on blogging I have found. It makes my head hurt sometimes because it is the real deal .

    I’ve been changing my permalink settings for months, going back and forth with the date setting mostly. Went to “pretty” permalinks after writing some “ugly” posts that still get some good organic search hits. Figure I’ve messed it up pretty thoroughly, so just installed Advanced Permalinks and will fool around with that for awhile, lol. Since I have very few Facebook likes, I fear little. Sincere thanks for the clarity.

    • First of all, thanks for the kind words. Nice to feel appreciated.

      Secondly, had you been changing your permalinks without 301 redirects in place? That’s unfortunate, but all is not lost because you can still set up the redirects and capture any traffic still going to indexed invalid addresses. Hopefully, you catch it before losing too much traffic, or standing. Use Google Webmaster Tools to see where 404 errors are popping up.

  5. Thanks so Much for this, I still have problems re-directing my default tags and category pages to the new ones which I have set. The posts now work fine. Any Ideas will be much appreciated.

  6. FYI: There is a statement on the plugin authors homepage saying he is no longer updating or supporting it. http://urbangiraffe.com/plugins/advanced-permalinks/

  7. I installed the plugin, set the old permalink structure on the migration tab and then updated my permalinks to use just /%postname%/, Everything worked fine except the category pages which brought me 404 errors.

    You say above to change the category and tag base in your permalinks setting, but there was never anything there to change. I do not understand.

  8. Very nice. but don’t work for me, my permalink setting is default, i.e. post id, so i can’t see what the old format is to put in the migration tab…any suggestions?

    • Well, you need to know what your old permalink setting is, before you change it. If you’ve already changed it, you could do a quick search for your site on Google and if it hasn’t updated it’s index of your pages, look at the URL and you should be able to work out what the old permalink structure was. It shouldn’t make a difference that your site is MU though.

  9. i.e. old permalink is /%post-id%/, put it, changed the permalink and…does not work…btw, my site is mu

  10. I’ve used WP’s default structure, so do I type in “www.knot-dresses.com/?p=123″ as the old? It doesn’t show a %xxx% for it. ?? Thanks so much for this post as it has helped me immensely to move my website to a better domain for seo – I’m just on the last step for improving my permalinks.

  11. Hi Dave, thanks for this information. I have one question: I’d like to change some of my headlines (title tags), which will change the url, but I have a lot of backlinks built to all of my url’s. If I change a title and use a 301 redirect to point to the new url, will I lose the seo benefit of the backlinks pointing to the old urls?

    • Firstly, if you change the title of a post that has already been posted, the permalink should not change. WordPress doesn’t let it, unless you specifically change it, to avoid this issue. Secondly, you won’t lost any SEO benefits provided that you have a 301 redirect in place. Google and all other SEs will treat the new URL as the old (and attribute all old backlinks to the new URL).

      • Oh ok. I assumed changing the title would change the permalink / url. So if I am only changing the title and the url remains the same, do I still need to set up a redirect? Or is a 301 needed only if I want to change the permalink structure?

  12. Recently I’ve changed permalink structure for my site
    /%category%/%postname% to /%postname%
    Through this article I came to know about 301 redirection, do I have to set that manually? while I check in browser typing old url I automatically redirected to new url with the same page, So it’s necessary to set 301 redirection…?
    Thanks for this article…!

    • This plugin does the 301 redirection for you, which is why when you put the old URL in your browser, you are automatically forwarded to your new URL. Sounds like everything is set up correctly.

      • What Ganesh was talking about is that his blog automatically redirects the old permalinks to the new structure without using the mentioned plugin. I have tried that myself and I think wordpress automatically redirects the old posts after permalink change.

        • Hmmm, I’d be surprised if it did, but that may have been a development that I wasn’t aware of. I’ll do a little research and see whether WordPress does this automatically now.

  13. Advanced permalinks plugin is no longer supported (and in fact breaks category links in WP 3.3).

    Can anyone suggest another way to redirect permalinks? Yoast has a htaccess rules generator here but it doesn’t seem to work for me!
    http://yoast.com/change-wordpress-permalink-structure/

    • I just saw an update of Advanced Permalinks come through just the other day (must still be supported). Check to make sure that you’re on the latest version.

      • Yep you are right it’s back! Must have been down momentarily while the author updated the plugin.

        I got Yoast’s tool to work – it requires .htaccess edit but it should put less load on the server than a plugin. If anyone else uses it, the edit should go just below RewriteEngine On

  14. FYI.

    Latest version of Advanced Permalinks 0.1.21 installed on WordPress 3.3.2 has been breaking the RSS feed.

    http://www.feedvalidator.org returns a “XML Parsing Error: no element found Line Number 1, Column 0″ error.

    It’s happened on multiple sites, all using different hosts and themes. If you’ve had luck with the plugin, congrats, but be wary because it’s caused a handful of issues in the past when upgrading.

    Just wanted to pass along the info.

  15. Dave, I can confirm the plugin no longer works on WordPress 3.4.1.

  16. Hi Dave,

    Thanks for yet another great post.

    It appears the whole permalink debate is not very straightforward and requires a fair bit of thinking.

    For example, If I run a blog which presently has one post per day (done by me alone) but then say I intend to have multiple authors added within a year and have the blog realise 10 or 20 posts per day, wouldn’t /%postname%/ be problematic? Would you then recommend a structure with a date?

    Many thanks!

    Kareem

  17. Whoa! This worked perfectly. I’ve tried a few other permalink redirect plugins that failed, but this plugin was a snap to set up.

  18. Hi Thanks for your valuable information.
    I am currently having one problem. i first had permalinks as “/Postname”
    and now i changed to “/postid/postname” . Now google has indexed both types of url in Google Searches. which is creating a mess in webmaster tool with duplicate meta title and description.

    Please Help Me Fix This.

    • Well, if you follow these instructions, then it will create a 301 redirect on your old content, thus attributing all of your old links to your new ones. If you made the change without doing this, revert back to the old permalink format, then change using this procedure and you’ll be covered.

  19. Hey Dave, thanks for the great insights and your commitment to answer each comment, impressing (support can be quite sad these days ;))

    1. I would like to relaunch my website, but have changed and minimized the entire url structure on the new site. Since various links from the old website are still linked up from forums etc, would if be possible to redirect those urls to the corresponding new ones, since the original Page/Url won’t exist anymore?

    2. While all my urls on the new website would be keyword targeted, i think it would make the most sense to internally link between pages by using the /?p=123 format, since this would allow me to quickly change the url name of a certain page without having to worry about breaking any links. Do you agree?

    Thanks,
    mattis

    • Mattis,

      Thanks for the compliments :)

      1. Absolutely. This is exactly the kind of issue described and remedied by this post. Just redirect your old permalink structure to your new one and all old links (from forums or wherever) will be 301 redirected to the correct URL.

      2. I disagree. It sounds like you’re planning to regularly change the permalink of the page to different keywords, perhaps based on its performance. I strongly discourage that. It’s a permalink for a reason: it’s intended to be permanent. You shouldn’t meddle with it. Making sure the content is unique, worthwhile and engaging is far more valuable than merely tweaking the URL. Keep the URL constant and using the linking tool to quickly and easily link to other pages on your site (using the correct URL).

  20. Hey Dave thanks for the quick reply ;)
    1. got it
    2. I don’t plan to change them often, but it might be that my client wants to change one or two url names over time when i am gone, thus i would like to set up so they can’t break the connection.
    Thanks,
    mattis

    • Even if that’s the case, I would recommend using a tool like Redirection to manually create 301 redirects in these instances. Then the connection won’t be broken. I don’t advise using “ugly URLs” just to point to the right page. This is a better method if you/your client insists on changing the permalink.

  21. Alright Dave,
    then I’ll go with that ;) Thanks a ton for your advise, I truly appreciate it.
    Have an awesome day!

  22. Hi there!
    They said this plugin doesn’t want work with WP starting from 3.4.1. What should I do to make it work or what can I use instead?
    Have tried this plugin with WP 3.5 – not working.
    Thanks!

  23. Thanks so much! works with 3.5.1 WP version. My slug was getting long and I want to move to the /year/month/ID structure but all my links was 404. This fixed it! Thanks!!

  24. HI – I saw this article a little too late as I changed my permalink structure without knowing how that would affect my website (as stated so elequently above). I did loose my Google ranking and I am hoping that “time” (waiting it out) will eventually heal this??? I’d appreciate your input. Thanks!

    • Mike,

      It’s OK – so long as you have implemented the redirection method now, Google will pick up on these articles having moved. Hopefully there wasn’t too much of a gap between changing the permalink structure and enacting the redirects?

      • Hi Dave,

        Thanks for your response.

        No, I never did that and it’s been over a month now so…?

        I also don’t remember “exactly” what my old permalink settings were and I know I would need to know that.

        Anyway – that’s why I was asking if they might repair themselves overtime???

        Thanks again.

        Mike

        • Mike,

          Well, it would repair itself over time, but who knows how long that might take. A way around this would be to look at Google’s index of your site and look what kind of URLs are indexed (which will indicate your former permalink structure). The sooner you can do that and implement the redirect, the better.

  25. Is the plugin still work? It has not been update for over 2 years now so I am a bit worry! Also, it’s reported that redirects are 302, not 301!

Leave a Reply