本文介绍了在Jekyll和GitHub Pages中重定向旧页面的最佳方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在github页面上有博客 - jekyll



解决url策略迁移的最佳方法是什么?

我发现最常见的做法是创建htaccess,像这样

 重定向301 / programovani / 2010/04 / git-co to-je-a-co-s-tim / / 2010/04/05/git-co-to-je-a-co-s-tim.html 

但似乎不适用于Github。我找到的另一个解决方案是创建rake任务,它将生成重定向页面。但是由于它是一个html,所以它不能发送 301 头,所以SE抓取工具不会将其识别为重定向。

解决方案

最好的解决方案是使用< meta http-equiv =refresh < link rel =canonicalhref =



效果很好,Google Bot将我的整个网站重新编入新链接,而不会丢失位置。

 < meta http-equiv =refreshcontent =0 ; url = http://konradpodgorski.com/blog/2013/10/21/how-i-migrated-my-blog-from-wordpress-to-octopress/> 
< link rel =canonicalhref =http://konradpodgorski.com/blog/2013/10/21/how-i-migrated-my-blog-from-wordpress-to-octopress/ />

使用< meta http-equiv =refresh会将每个访问者重定向到新帖子。
对于Google Bot来说,它将< link rel =canonicalhref = 视为301重定向,结果是,您的网页被重新编入索引,那就是你想要什么。



我描述了我的博客是如何将我的博客从Wordpress移动到Octopress的。


I have blog on github pages - jekyll

What is the best way to solve url strategy migration?

I found the best practice in common is create htaccess like so

Redirect 301 /programovani/2010/04/git-co-to-je-a-co-s-tim/ /2010/04/05/git-co-to-je-a-co-s-tim.html

But it does not seems to work with Github. Another solution i found is create rake task, which will generate redirection pages. But since it's an html, it's not able to send 301 head, so SE crawlers will not recognize it as an redirection.

解决方案

The best solution is to use both <meta http-equiv="refresh" and <link rel="canonical" href=

It works very well, Google Bot reindexed my entire website under new links without losing positions. Also the users are redirected to the new posts right away.

<meta http-equiv="refresh" content="0; url=http://konradpodgorski.com/blog/2013/10/21/how-i-migrated-my-blog-from-wordpress-to-octopress/">
<link rel="canonical" href="http://konradpodgorski.com/blog/2013/10/21/how-i-migrated-my-blog-from-wordpress-to-octopress/" />

Using <meta http-equiv="refresh" will redirect each visitor to the new post. As for Google Bot, it treats <link rel="canonical" href= as 301 redirect, the effect is that you get your pages reindexed and that is what you want.

I described whole process how I moved my blog from Wordpress to Octopress here.http://konradpodgorski.com/blog/2013/10/21/how-i-migrated-my-blog-from-wordpress-to-octopress/#redirect-301-on-github-pages

这篇关于在Jekyll和GitHub Pages中重定向旧页面的最佳方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-30 00:39