301 redirect for site hosted at github?

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

To avoid the duplicate content, in a first time you can add a meta canonical like this:

<link rel="canonical" href="http://casperjs.org">

You can redirect using Javascript after host detection, like this:

if (window.location.href.indexOf('http://niko.github.com') === 0) {
    window.location.href = 'http://casperjs.org{{ page.url }}';
}

But I agree, it's not an HTTP redirection.


Why didn't you use http://www.w3.org/TR/WCAG20-TECHS/H76.html?

That would give

<meta http-equiv="refresh" content="0;URL='http://casperjs.org/'" />