Skip to content

How to Change your Permalink Structure Without Breaking your Links

1 Feb 2011 (Updated: 2 Feb 2012) • 35 comments Installation, Plugins, Wordpress

Manage your links in WordPress

Image courtesy of chefranden

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

http://www.doitwithwp.com/?p=123

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

http://www.doitwithwp.com/2010/12/sample-post-title/

and

http://www.doitwithwp.com/2010/12/31/sample-post-title/

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

http://www.doitwithwp.com/sample-post-title/

The syntax for this permalink structure is:

/%postname%/

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?

Recommended WordPress Hosting

Save 25% on HostGator hosting packages by using coupon DIWW25PCOFF
Or save $9.94 by using coupon DIWWSAVE10
Hosting packages for WordPress

About the Author

Dave Clements designs awesome websites and offers WordPress consulting services in his spare time, along with eating Wheat Thins, spending time with friends and family, watching Indie films and playing with his array of Apple products.

Like it? Share it!

Comments

  1. Dana May 17, 2011

    I just have plan to change my permalink instruction but worry about the effective of SEO. Thank you for your tips that help !
    Dana recently wrote Where is the best place to buy HP server in Dubai

    • Dave Clements May 18, 2011

      Changing permalinks is one of the easiest tasks to undertake if you do it properly. The 301 redirect instantly informs search engines where your content has moved and if done correctly, you won’t be penalised at all.

  2. Dana May 19, 2011

    Thank you for your suggestion. I will make a change for now.
    Dana recently wrote Do you need an MA in interior design in order to work as a preoffessional interior designer

  3. Kevin Velasco June 4, 2011

    Is it possible to change a permalink but transfer the number of Facebook “Likes” it has received? Thanks.
    Kevin Velasco recently wrote Finding Your Passion with Passion Probing

    • Dave Clements June 4, 2011

      I’m afraid not. Facebook like counts and tweet counts are tied to unique URLs. Even if you 301 redirect, counts will be lost. Unfortunate side effect. I just went through it with changing my domain name on this site

  4. AstroGremlin August 31, 2011

    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.
    AstroGremlin recently wrote Review of doitwithwp.com

    • Dave Clements August 31, 2011

      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. Alex September 26, 2011

    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. Jeff January 4, 2012

    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/

    • Dave Clements January 4, 2012

      Thanks for letting us know John. As it stands, I still have the plugin active and it still works for me and hopefully it continues that way.

  7. Website Solutions by KC January 15, 2012

    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. Boaz January 17, 2012

    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?

    • Dave Clements January 17, 2012

      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.

      • Boaz January 17, 2012

        it was post_id, changed to custom. I get read posts, but when I click on a category i get nothing was found for the blog category message…any advice?

        • Dave Clements January 17, 2012

          Do you know what it used to be and what you want it to be? Check Google for a cached category page to see what the URL used to look like.

  9. Boaz January 17, 2012

    i.e. old permalink is /%post-id%/, put it, changed the permalink and…does not work…btw, my site is mu
    Boaz recently wrote שבו לי

  10. Kyle Travers January 19, 2012

    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.
    Kyle Travers recently wrote New Listing Cupcake Delights Peasant Dress

  11. Darrell January 20, 2012

    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?

    • Dave Clements January 20, 2012

      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).

      • Darrell January 20, 2012

        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?

        • Dave Clements January 20, 2012

          No. If the post is already published, the permalink won’t change (try it on one and check). You’ll only need to do the 301 redirect if you change the permalink structure.

  12. Ganesh Maharjan February 6, 2012

    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…!
    Ganesh Maharjan recently wrote MCQ of Microsoft Access – Set 6

    • Dave Clements February 6, 2012

      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.

      • Codeirsh March 6, 2012

        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.
        Codeirsh recently wrote Hello world!

        • Dave Clements March 7, 2012

          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. Stephen April 28, 2012

    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/

    • Dave Clements April 30, 2012

      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.

      • Stephen April 30, 2012

        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

Add a Comment

Name - Required

Email - Required

Website - Optional

CommentLuv badge