How to Redirect URLs in Jekyll Using Github Pages and the jekyll-redirect-from Plugin02 Apr 2014
When changing the permalink structure of your blog or migrating your blog from one blogging platform to another, you often want to change the permalink structure of your blog but keep the old URLs and have them redirect to the new pages. This will allow you to preserve your Google search rankings, tweet history, SEO, etc.
Install jekyll-redirect-from. To do that, I ran the command
gem install jekyll-redirect-from --source http://rubygems.org
Include this plugin in Jekyll by adding to your
gems: - jekyll-redirect-from
Add to the YAML metadata of the post a line describing the old URL which should be redirected. For example, if the original URL for this post was joshualande.com/2014/04/02/minimal-urls-jekyll, then we could redirect that URL to the new URL by adding a line to the YAML metadata of this blog post:
jekyll-redirect-from is further documented here.
Finally, if you use DISQUS to host comments on your blog, you will have to explicitly tell DISQUS that you changed the URLs for your blog posts. DISQUS provide an easy URL Mapper which is documented here.