redirect - 301 重定向到 github 托管的网站?

标签 redirect github hosting jekyll github-pages

这是我的 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/

相关文章:

.htaccess - Magento 使用 302 重定向到基本 url,我如何让它使用 301

windows - Jenkins 不能很好地处理私有(private) GitHub 存储库 (Windows)

wcf - 通过 Https 自托管 WCF 服务

azure - 由于 azure 网站无法将 IP 地址解析为网站,因此无法进行 A 记录重定向

android - 我如何托管可以在浏览器、Android 和 iOS 上由共享云上相同数据库的用户使用的 Web 服务?

apache - 仅使用 htaccess 重定向基本 url

python - 获取下一个 View 中如何使用 HttpRedirect 调用 View

python - 我可以将标准输出重定向到某种字符串缓冲区吗?

git - 有没有办法使用逻辑 AND 在 GitHub 操作中组合推送标准?

github - 如何在 github 上轻松取消观看多个仓库?