I have changed my repo from foo to bar . So automatically the github page url changed from /foo to /bar but i want that /foo also redirects to /bar. How can I achieve this ?
I am using a custom domain but I don't think that makes any difference.
I have changed my repo from foo to bar . So automatically the github page url changed from /foo to /bar but i want that /foo also redirects to /bar. How can I achieve this ?
I am using a custom domain but I don't think that makes any difference.
It seems GitHub doesn't redirect the pages when renaming repository:
GitHub Pages sites are not automatically redirected when their repositories are renamed at this time.
I think you can still make a redirect by adding a page to your ritz078.github.io project. Create embed-js.html
with:
---
permalink: /embed-js/
---
<!DOCTYPE html>
<meta charset=utf-8>
<title>Redirecting...</title>
<link rel=canonical href="http://rkritesh.in/embed.js/index.html">
<meta http-equiv=refresh content="0; url=http://rkritesh.in/embed.js/index.html">
Recreate an embed-js
repository
In the gh-pages branch
add an index.html
file that contains:
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<meta http-equiv="refresh" content="1;url=http://rkritesh.in/embed.js/">
<script type="text/javascript">
window.location.href = "http://rkritesh.in/embed.js/"
</script>
<title>Page Redirection</title>
</head>
<body>
<!-- Note: don't tell people to `click` the link, just tell them that it is a link. -->
If you are not redirected automatically, follow the <a href='http://rkritesh.in/embed.js/'>link to example</a>
</body>
</html>
But this will only redirect the traffic from http://rkritesh.in/embed-js/
other page like http://rkritesh.in/embed-js/anypage/
will get a 404 error.
reference : https://stackoverflow.com/a/5411601/1548376