I have created a Github Pages site and put it on repository abc of github account with username xyz. So, my site is now live on xyz.github.io/abc I created a cname file with my custom domain, and configured my DNS with the settings said on Github pages. Now, my site is also live on mycustomdomain.com Now, I don't want my site to be live on xyz.github.io/abc . I want it to redirect to mycustomdomain.com or not accessible. Is there any way to do that? I know that I can create User Pages site (with username.github.io) which will automatically redirect to custom domain, but I want to create project site. Any suggestions?
You can customize the domain name of your GitHub Pages site. GitHub Pages is available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server.
GitHub Pages is just the solution to that problem. It's free. You can host your website, including custom domain names(https://dhrumil.xyz), 404 error page, sub-domain (https://blog.dhrumil.xyz) and all over secure https.
You can use GitHub Pages to host a website about yourself, your organization, or your project directly from a repository on GitHub.com.
GitHub Pages doesn't support dynamic websites or anything requiring a backend or secret data. There are other sites that provide this kind of hosting, such as Netlify and Heroku, along with many others.
A CNAME solution:
Sure. Github has a nice functionality for it.
When you create CNAME
folder inside of your repo, you will be redirected:
https://help.github.com/articles/adding-a-cname-file-to-your-repository/
Check out my Github Pages website: https://github.com/ondrek/ondrek.github.io
( you can browse ondrek.com, but it's impossible to browse ondrek.github.io )
A JS solution:
If you want to redirect a custom page — the only possible solution will be javascript redirection.
if (window.location.href==="https://xyz.github.io") {
window.location.href = "https://mycustomdomain.com";
}
but it will not solve your problem with Google. You can solve this with correct using Google Webmaster Tools and tell to Google about the duplicate (for SEO purposes).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With