Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
395 views
in Technique[技术] by (71.8m points)

301 redirect for site hosted at github?

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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"
---

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...