Redirect Github Pages to custom domain - github

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?

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).

I had a GitHub Pages website (https://kamarada.github.io/), I moved it to GitLab (https://kamarada.gitlab.io/) and besides that I set up a custom domain on GitLab (https://linuxkamarada.com/). Now the question: how to make a 301 redirect from the GitHub Pages to the custom domain? Is that possible?
Well, as Ciro Santilli answered on this other question, there is no "beautiful non-plugin solution". Indeed, the solution I found is not beautiful, it is more kind of a workaround, but it works.
Inspired by the Samuel Ondrek answer on this same question (thanks a lot!), I set up CNAME redirection.
Go to your GitHub Pages repo, click Settings and below GitHub Pages, under Custom domain, enter your custom domain and click Save.
Now open another tab on your browser, open DevTools (F12), select the Network tab. Try to access your GitHub Pages website and see that a 301 redirect happens.
GitHub is going to complain that your domain is not configured properly:
Well, that does not really matter. What matters is that you have the 301 redirect required by the Google Search Console's Change of Address Tool and your website won't lose its Google ranking.

This might be a bit old but I'd still like to give an alternative answer to this. You can simply use meta refresh on your index.html
<meta http-equiv="refresh" content="1;url=http://example.com/" />
Then use a regular link (an a message also) on the page in case refresh stops. Though it is not recommended for SEO since google might index the blank page. But it would most likely work work.

You could use JavaScript to inspect the domain of the current page and redirect if necessary. If you go this route, the question and answer are already on SO:
Redirection based on URL - JavaScript

Related

Redirect Github homepage to custom homepage

I used to host my webpage on username.github.io.
I have now set up a new webpage on username.com, and has no relation to username.github.io.
However, I want to redirect username.github.io to username.com.
As of now, if somebody enters username.github.io, it takes you to the 404 not found page.
Is there anyway I can reroute it to username.com?
Instead of a redirect, the normal process is for your current GitHub pages to use a custom domain
You find a better illustration of that process here
Go to your GitHub Pages site’s repository settings.
Under “Custom domain”, add or remove your custom domain and click “Save”.
Setting “custom domain” creates a file named CNAME in the same repository.
Don’t delete it.
The OP sidv adds in the comments:
After setting up my website (deployed elsewhere) and the DNS servers, I was unable to open the webpage on Safari and Firefox (only on Chrome).
Finding the load balancing IP and configuring it as an A record ended up redirecting the webpage appropriately.

Different custom domains for GitHub user page and project page?

Is it possible to associate more than one custom domain with the same GitHub user account? I would like to use one custom domain for my personal page and another custom domain for a project page.
Specifically, I would like www.deeplearningbook.org to show the GitHub pages for the goodfeli/book project, and www.iangoodfellow.com to show the GitHub pages for the goodfeli/goodfeli.github.io user page. (And if I can be ambitious, I'd like blog.iangoodfellow.com to show the GitHub pages for goodfeli/blog)
I have tried a few different ways to set them up, and everything I have done has ended up with one URL or the other working but not both.
My current setup is a huge mess, but since a commenter asked me what my name records currently are:
iangoodfellow.com: I deleted all name records after the last failure. namecheap filled in a default parking page thing. I deleted the custom domain field from the goodfeli/goodfeli.github.io repository on github. Strangely, http://goodfeli.github.io successfully loads but https://goodfeli.github.io redirects to the broken www.iangoodfellow.com parking page. I'm not very happy that github is doing that... I didn't realize that taking down goodfeli.github.io was a possible failure mode here.
deeplearningbook.org: I doubt this is the correct thing to do, but it's the only thing I've been able to get to work so far:
Redirect domain: deeplearningbook.org -> https://www.deeplearningbook.org
A record # 192.30.252.153
A record # 192.30.252.154
CNAME Record www goodfeli.github.io.
It's that last CNAME record that I think is the problem. Having the goodfeli.github.io CNAME record for www.deeplearningbook.org prevents me from linking a different domain to the goodfeli.github.io personal page.
I haven't been able to figure out how to link www.deeplearningbook.org specifically to the goodfeli.github.io/dlbook project page though.
Yes in short, through one sub domain exampleUser.github.io, for example, my page https://shushugah.github.io is my main one, and maps to a custom domain https://shushugah.com while https://shushugah.github.io/23 links to a different github page at https://2Jews3Opinions.com One side effect of this is that https://shushugah.com/23 also redirects to https://2Jews3Opinions.com
I detail this in my blog post https://medium.com/#shushugah/2-customs-domains-for-2-github-pages-a8a9e77d3e57

Redirects in Ektron 8.6.1

Has anyone played with the new redirect feature in Ektron 8.6?
We tested it (in 8.6.0) before upgrading and were happy with it. But when it came time to do the upgrade, Ektron had released 8.6.1, so we upgraded directly to that.
Now we are having trouble with the redirect feature. (Yes, we should have tested everything again in 8.6.1 before upgrading)
Now if we try to add a redirect rule for an existing page in the CMS, it does not work.
But if we create a redirect rule for a page the does not exist, then try to hit that address, the redirect works fine.
We need the redirects to work for existing pages in the CMS.
To clarify what "working" and "not working" means...
If I have an existing page in the CMS with manual alias of "/erc/lucien.apsx", I can create an entry in the redirect table like this...
Adding this entry generates no errors, but when I visit the page, all I see is the regular old page I created. NOT the Google site it should be redirecting to. I do not get any 404 errors.
But if I create a redirect entry for a page that does not already exist, like this...
It works perfectly. If I try to visit the /erc/fake.apsx address, I end up on the Google site, as expected.
(FYI, we create a "fake" page in the CMS for external content so we can attach metadata to it and make it searchable in taxonomies, but then provide a link to the "real" page. I want to use redirects here so users don't have to do this extra click)
I suspect it might be cache related -- the original URL gets cached as an alias, then subsequent requests to that URL are redirected to the quicklink without the need for a db look up. When you add the redirect, it’s probably not clearing the old item from the cache. I'd try an IIS reset after you add the URL redirect and see if that clears up the issue.
An "outside the box" (of Ektron) answer to this is to place the redirect at the web server rather than in the Aliases section of the Ektron CMS.
The server I work on uses IIS and I have this set up for several pages.

Redirect to default domain in Business Catalyst

I have a Business Catalyst site that needs the following domains redirected to the default domain.
www.membersalliance.com.au/
www.membersalliance.com.au/index.aspx
The default domain is www.membersalliance.com.au
We have been told that these three pages are seen by google as separate content and we want to consolidate them to all go to the default domain.
I have spoken to adobe support and they said that:
‪
Redirecting to another page can be done, there's no issue with that. But what we're looking for here is to not have any other postfix with the domain name. When a page is set to be the starting page, there is an automatic functionality that the postfix/name of the page is removed, but that is not the case with other pages.‪So, they would still show the name of the page, even if you redirect it to the home page (starting page set for your domain).‬
So, I can redirect to www.membersalliance.com.au/home.html but is this seen by google as a separate page to www.membersalliance.com.au?
If you re-direct a page using 301 redirects (which is how BC re-directs a page if you use re-directs) Google will only see the one page, not multiple pages.
Take a look at the Google Webmaster Tools help on "canonical" URLs.
https://support.google.com/webmasters/answer/139394?hl=en
In your case, add to page head:
<link rel="canonical" href="www.membersalliance.com.au"/>
This will tell Google to treat all variants of homepage to be recorded against a single domain.

Redirect to a specific page on a DNN site with an extensionless URL

I have a page on my DotNetNuke site and I would like to set up a redirect and was wondering the best way to do it. Here is the problem:
I have a page on the site: mydomain.com/dashbaord.aspx. I would like users to be able to type mydomain.com/dashboard OR mydomain.com/Dashboard and it will redirect them to the /dashboard.aspx page.
I have IIS6, so I set up wildcard mapping, and it seemed to work for /dashboard, but not /Dashboard. Also, I am looking for it to literally redirect you so that /dashbaord.aspx shows up in the address bar. In addition, the wildcard mapping broke some other links on the site, so I was looking for an alternative method to accomplish this. Is there a way that I can set this up through IIS? Or any other way?
Thanks in advance for the help.
In IIS, create a virtual directory by right clicking on Sites, and then call it Dashboard. Then set that to redirect to a specific URL, in your case, http://mydomain.com/dashboard.aspx.