I want to create a homepage and, for now, I think Github's pages features will serve my needs. However, I might want to switch to a more full-blown CMS/blog engine later on.
Is it possible to serve a permanent redirect (HTTP 301) from Github pages in case I decide to move my homepage someplace else while preserving all the old URIs?
Best I can deduce is that Github has not yet added this. See Tekkub response from April 2010 re: adding it to the feature request list. Another message from another user in January suggests a META tag as a workaround (probably not a good solution).
For the security of their users, GitHub Pages does not support customer server configuration files such as .htaccess or .conf. However, using the Jekyll Redirect From plugin, you can automatically redirect visitors to the updated URL.
More info can be found here: https://help.github.com/articles/redirects-on-github-pages/
Mass redirect layout technique
Individual page redirects are covered at: https://stackoverflow.com/a/36846720/895245 Actual 301s seem impossible.
If you want to mass redirect:
to:
do as follows.
Before you move away
_layouts/default.html
: the default layout_config
uses the default layout:After you move away
create
_layouts/redirect.html
with an HTML redirect derived from Redirect from an HTML page along:_config
contains:replace every non-default layout with a symlink to the
redirect
layout. This is the only ugly part of this technique. I don't see a beautiful non-plugin solution.