Skip to content

How to provide redirect for this scenario? #127192

Closed Answered by yoannchaudet
syeda-git asked this question in Pages
Discussion options

You must be logged in to vote

GitHub Pages does not maintain custom domain redirections upon changes.

There are many different solutions if you don't use GitHub Pages, but here is how I would do it on Pages:

  1. Create a new repository (e.g. by cloning your existing repo) and setup Pages to use the new domain you intent to use

  2. On your previous repo (i.e. setup to point to your previous URL), remove all content but leave a single index.html (and 404.html) file containing the same content: a meta HTTP redirect (doc). When someone access this old URL (or any path on it that would result in a 404 error), they will be redirected to your new URL. It's not perfect but should handle most things.

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by LiteBrite82
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Pages Host a static website, right from your repo Question
2 participants