AlanPear
AlanPear

Reputation: 737

Github User Pages and Custom Domain Issue

I have a couple of issues I believe are related regarding githubpages.

First, when trying to create my user page by naming the repo the same as my username, I expect the url to be this myusername.github.io.Instead it looks like this myusername.github.io/myusername.

I have been to work around this by naming my repo myusername.github.io, which produces the correct URL.

Now, I want to create a custom domain with this user page. I can use my custom domain with the above workaround, but this now affects all other repos which use github pages. For example, I setup myusername.github.io to use mycustomdomain.com. But now I have another project that uses gh pages called someotherproject. The url now redirects to mycustomdomain.com/someotherproject instead of someotherproject.github.io.

Is this working correctly?

Upvotes: 1

Views: 398

Answers (1)

VonC
VonC

Reputation: 1328202

But now I have another project that uses gh pages called someotherproject. The url now redirects to mycustomdomain.com/someotherproject instead of someotherproject.github.io.

This is what described in the official documentation "Supported custom domains"

After you configure a custom domain for a user or organization site, the custom domain will replace the <user>.github.io or <organization>.github.io portion of the URL for any project sites owned by the account that do not have a custom domain configured.

For example, if the custom domain for your user site is www.octocat.com, and you have a project site with no custom domain configured that is published from a repository called octo-project, the GitHub Pages site for that repository will be available at www.octocat.com/octo-project.

That was reported as an issue in 2016:

I'm afraid this can't be disabled. If you have a CNAME file in a User pages site you other project pages will redirect to this Url.

You can override it by adding a different CNAME to your project page though or just create another Project site to act as your user page.

In 2020, here is a possible workaround, mentioned by Oliver Vorasai:

The Problem

The Solution

Not ideal though, as mentioned by Emma Sax :

I still think the best solution would be an option in the GH Pages settings of a project page to not redirect the domain of a project page.

This way, users would have a choice of having username.github.io/project-page redirect to www.customdomain.com/project-page or having it stay where it is.

It's frustrating to me that we even need to find an alternative solution at all.

Upvotes: 2

Related Questions