Organization site to redirect old GitHub Pages URLs.
Renaming or transferring a repository has an impact on URLs:
- ✅ New repo URL
https://github.com/<new_org>/<new_repo>
is created. - ✅ Old repo URL
https://github.com/<org>/<repo>
will automatically redirect to the new repo URL. - ✅ New GitHub Pages URL
https://<new_org>.github.io/<new_repo>
is created. - ❌ Old GitHub Pages URL
https://<org>.github.io/<repo>
returns a 404 error.
Any reference to the old Github Pages URL https://<org>.github.io/<repo>
is now broken.
This https://github.com/<org>/<org>.github.io
repository has an associated organization site, served from https://<org>.github.io
. By creating subdirectories, we can redirect old GitHub Pages URLs:
- Rename or transfer your
<repo>
. This will break the old GitHub Pages URLhttps://<org>.github.io/<repo>
. - Create a directory in this repository, named
<repo>
(see the repo for examples). - Add an
index.html
to that directory, with the following content (replace theURL
with the new GitHub Pages URL):
<html>
<head>
<meta http-equiv="refresh" content="0;URL=https://<new_org>.github.io/<new_repo>/">
</head>
</html>
- Commit.
- A page will now be served from the old GitHub Pages URL
https://<org>.github.io/<repo>/
. It will redirect without delay to the new GitHub Pages URL.
Note that only the homepage https://<org>.github.io/<repo>/
will be redirected. This is typically sufficient, since subpages are seldom referenced elsewhere. To redirect subpages, either:
- Add a
404.html
with the same content asindex.html
to redirect all subpages to the new homepage. - Add a
path/to/subpage/index.html
file (with specificURL
) to redirect a specific subpage.