这是我的 Github 存储库:https://github.com/n1k0/casperjs
有一个 gh-pages
分支来保存项目文档,基本上就是项目网站:https://github.com/n1k0/casperjs/tree/gh-pages
此分支将文档站点设置为 http://n1k0.github.com/casperjs/ ——万岁。
同时,我购买了 casperjs.org
域,以便通过它访问该网站,因此我将 CNAME
文件设置为 recommended in the docs : https://github.com/n1k0/casperjs/blob/gh-pages/CNAME - 在他们的示例中,该操作应该创建从 www.example.com 和 charlie.github.com 到 example.com 的重定向...
虽然网站现在指向http://casperjs.org/ ,没有来自 http://n1k0.github.com/casperjs/ 的 301 重定向(旧网站网址)到新域名。
如果可能的话,知道如何设置这样的重定向吗?这是一个错误吗?如果是,我应该在哪里提出问题?
最佳答案
让这个话题起死回生,提到GH现在支持redirect-from的redirect-to参数https://github.com/jekyll/jekyll-redirect-from#redirect-to
只需将其添加到您的 _config.yml
gems:
- jekyll-redirect-from
这位于索引页的顶部。
---
redirect_to: "http://example.com"
---
关于redirect - 301 重定向到 github 托管的网站?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9276817/