301在github上托管的网站的重定向? [英] 301 redirect for site hosted at github?
问题描述
这是我的一个Github存储库: https://github.com/n1k0/casperjs
p>有一个 gh-pages
分支来存放项目文档,基本上是项目网站: https://github.com/n1k0/casperjs/tree/gh-pages
该分支在 http://n1k0.github.com设置文档网站/ casperjs / - hurray。
与此同时,我将 casperjs.org
域来获得这个网站,所以我把一个 CNAME
文件作为在文档中推荐: https://github.com / n1k0 / casperjs / blob / gh-pages / CNAME - 在他们的例子中,操作ion应该创建来自www.example.com和charlie.github.com的重定向到example.com ...
虽然网站现在指向 http://casperjs.org/ 中,没有来自 http://n1k0.github.com/casperjs/ (旧网站的网址)到新的域名。
任何想法如何设置这样的重定向,如果甚至可能的话?这是一个错误吗?如果是这样,我应该在哪里开一个问题?
解决方案- 从重定向到参数 https://github.com/jekyll/jekyll-redirect - 从#重定向到
只需将它添加到您的_config.yml中
gems:
- jekyll-redirect-from
到您的索引页的顶部。
---
redirect_to:http://example.com
---
Here's a Github repository of mine: https://github.com/n1k0/casperjs
There's a gh-pages
branch to hold the project documentation, which is basically the project website: https://github.com/n1k0/casperjs/tree/gh-pages
This branch setups the documentation site at http://n1k0.github.com/casperjs/ — hurray.
In the meanwhile, I've bough the casperjs.org
domain to get this website available through it, so I put a CNAME
file as recommended in the docs: https://github.com/n1k0/casperjs/blob/gh-pages/CNAME — in their example, the operation is supposed to create redirects from www.example.com and charlie.github.com to example.com…
While the website now points to http://casperjs.org/, there's no 301 redirect from http://n1k0.github.com/casperjs/ (the old site url) to the new domain name.
Any idea how to setup such a redirect, if it's even possible? Is it a bug? If it is, where should I open an issue?
Bringing this topic back from the dead to mention that GH now supports redirect-from's redirect-to parameter https://github.com/jekyll/jekyll-redirect-from#redirect-to
Simply add this to your _config.yml
gems:
- jekyll-redirect-from
And this to the top of your index page.
---
redirect_to: "http://example.com"
---
这篇关于301在github上托管的网站的重定向?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!