Merging or migrating blogdown sites

By Charlie Joey Hadley | May 5, 2020

Until this week (4th May 2020) I was maintaining two separate {blogdown} sites, but no more. I’ve now redirected every blogpost from my old visibledata.co.uk/blog to this findingyourway.io/blog.

If you’d like to do something similar this short post will show you how, provided your sites meet all of these conditions:

  • Both {blogdown} sites are deployed with netlify.com, as recommended in the Blogdown book.

  • The .Rmd blogposts from your original site (my-phd-blog.co.uk) can be dropped directly into your new site’s (my-professional-blog.co.uk) folder and they just work1.

Step 1: Add a file called _redirects into the old my-phd-blog/static directory, and add the following:

/blog/*    https://www.my-professional-blog.co.uk/:splat 301!

Let’s breakdown this redirect:

  • * represents anything placed after blog in the following URL my-phd-blog.co.uk/blog/

  • :splat grabs the contents of * and appends it to the new URL

  • 301 is the type of redirect we’re using; 301 is a permanent redirect and will ensure that search engines redirect traffic succesfully.

  • The ! guarantees that redirects occur even if a reader types the explicit path to an old post, eg my-phd-blog.co.uk/blog/2020/01/01/ny-resolutions-2020.html. See Netlify’s page on shadowing for more information.

Step 2: Enjoy your redirected blogposts!

The image below shows a Google Search result for my 2018 blogpost about changes to {ggmap}, because we chose a 301 redirect clicking on this link would take you to my new blog.

Screenshot of a Google Search result for a blogpost from my old blog

For more complicated redirects I recommend reading Yihui Xie’s personal experience of successfully redirecting URLs all the way back from 2005 to today.


  1. Remember to move any images or other assets from my-phd-blog/static into my-professional-blog/static. RStudio 1.3 includes the ability to find and replace across files in a directory, this might help you minimise the manual steps in migrating your files.↩︎