Skip to content
This repository has been archived by the owner on Nov 18, 2021. It is now read-only.

User / Organization Pages custom domain affects all project pages URL #547

sergeylukin opened this issue Jan 11, 2016 · 22 comments


Copy link


Currently, as far as I'm concerned having User Pages repository with CNAME file containing custom domain prevents one from having Project Pages repository with gh-pages branch that could be accessible via http(s)://<username> without being redirected to http://<custom domain>/projectname. I believe that having an option to disable that redirect on Project Pages repository basis would be awesome.

Here is my reasoning. I'm hosting my personal website with my User Pages repository via custom domain. However, when building an experiment / game / little project and hosting it with Github Project Pages I'm adding another dependency on my custom domain and if, for some reason, I will lose control over my custom domain in the future, all my experiments / games / little projects / whatever else hosted with Github Pages will not be accessible via indexed / promoted / remembered / written down / bookmarked URLs. However, if they were initially created with "redirect" option turned off and promoted and known to crawlers under location of type http(s):// they would not be affected by me losing / deprecating / changing custom domain.

The only workaround I can think of right now is creating a separate User / Organization for my personal website repository while keeping the rest of my projects repositories in my current account.

Actually already today separating my personal website custom domain from my other projects hosted with Project Pages would require going over every project URL and setting up a proper 301 redirect from custom domain subdirectory to https://<username> to prevent existing links spread among the Internet from becoming obsolete and to avoid SEO troubles for custom domain because I have them all indexed for a while. So it's clear to me that there should be at least an option to break tight dependency between User / Organization Pages custom domain and Project Pages URLs. Not to mention, I'm all against that dependency at first place.

Details on how custom domain work in GH pages today:

Copy link

sh78 commented Mar 15, 2016

Just encountered the same issue.

I've had a personal jekyll blog hosted on gh pages with a custom domain name. While working on a chrome extension, I thought "oh cool, just init a gh-pages branch in the project repo and push that up for a quick site". Then realized that redirects to with a lovely 404.

For now I've created a new organization specifically for the project AND a separate repo so that with the site source so it can be used as an org page as opposed to a project page - instead of

Annoying but it works. Would be cool have more control over this from the GH side of things.

Copy link

cben commented May 19, 2016

Asked "contact a human" to clarify, got detailed answers (bold mine):

Will this redirect even work? I'd expect* to only resolve user/ content? Does automagically serve user/projectname gh-pages content?

Yep the will automagically serve user/projectname gh-pages content.

What if user/ happens to contain a projectname/ directory?

This question doesn't have a super clear answer I'm afraid. It should still direct to your project site but I've seen some people have issues where it 404's

Can it be disabled? I now have no user page, only project pages, and I'd prefer project pages to keep their canonical URL even if I create a user page with vanity domain in the future.

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.

What if both user page and project page have CNAME files? Which redirect wins?

If you have a different CNAME in your project page then do redirect occurs. User page will be redirected to the CNAME in the user repo and the project page will be redirected to the CNAME in your project repo.

What if project page has CNAME and there is no user page (or one with no CNAME)? This redirects to project's CNAME, right?

Yep, correct!

Copy link

Thanks @cben, very informative. I've tried adding a CNAME to a project pages site gh-pages branch and it doesn't seem to override the redirect to user pages CNAME. I've tried multiple values for project pages CNAME (btw unfortunately <username> in CNAME is not allowed, otherwise it would just fix the problem).

Here is the project pages CNAME:

and here is the user pages site CNAME:

Still, is redirected to

Copy link

At this moment,
if you want to have custom domain for some Project Pages, and you have created User / Organization Pages,
then you must to add any (temporary) custom domain for your User / Organization Pages, because it activates the custom domain for all your repo's Pages.

Copy link

deevus commented Aug 30, 2016

@BasiiSania I don't really understand the solution

Copy link

danbovey commented Nov 19, 2016

I think GitHub added a new section to fix this.


I'm not sure whether it was changing the CNAME of my repo temporarily to the other custom domain or switching the domain's NS to CloudFlare (free tier) - but give those a try and it's totally possible.

Also, if you set CloudFlare to Full SSL, you can get HTTPS on the custom domain, so it also solves #156

Copy link

thecristen commented Feb 11, 2017

That won't let us get a <username><project> URL that we want.
Just chiming in to say I'd also love a solution to this that doesn't involve the overhead of creating N separate organizations.

Copy link

Same issue here.

Copy link

bntzio commented Mar 16, 2017

So as far as I know, it's not possible to have a User page with a custom domain (let's say... and various Project pages with custom domains (like..., and so on).

Am I right?

Copy link

@bntzio that's right as far as I'm concerned. This issue is about having both custom domain for repo and other repos that are available via without being redirected to custom domain associated with repo. Hope that helps

Copy link

bntzio commented Mar 17, 2017

@sergeylukin oh alright, thanks! so the only option available for the moment is to create an organization page 😪

Copy link

rodrimaia commented Apr 6, 2017

@sergeylukin still unresolved, right?

have you got any success with the project's CNAME approach?

Copy link

cedricium commented Nov 30, 2017

@rodrigomaia17 I'm not sure if something has changed but I was able to successfully add a custom domain to a project of mine with using a CNAME while also having a custom domain for my user account.

Custom User domain:
Custom project domain: will successfully redirect to I had reached out to GitHub support and this is how was their response:

Hi Cedric,

    "Is it possible to give "" (which will redirect to 
"") it's own custom domain, such as ""? From what I read
online, it looks like it's not possible if the user account has a custom domain already set."

Thanks for writing in! It's absolutely possible for your Project Pages site to have a different custom 
domain than your User Pages site. We handle all the routing for you on our end. The way you'll set
this up is virtually the same way you've set up the custom domain on your User Pages site.

    Add your custom domain for your GitHub Pages site to your repository
    Create an A-record in your domain's DNS settings with a hostname of @ pointed to
    Create a second A-record in your domain's DNS settings with a hostname of @ pointed to
    (Optional) Create a CNAME record in your domain's DNS settings with the subdomain www pointed to

More information on steps 2-4 can be found here:

Copy link

dtolb commented Nov 30, 2017

Something changed, b/c it broke my sites :(

Copy link

@dtolb @bntzio @rodrigomaia17 @sergeylukin @julianofischer
It's counter-intuitive a bit. Check out

I have it working though. &

This is what my namecheap setup looks like.


Copy link

Didn't try the CNAME/ALIAS solution, but here is mine

I migrate my http(s)://<username> to netlify and use a custom domain there.

Doing this I gained a lot of flexibility on deploying the codebase
My other projects should be fine into Github Pages

boatrite pushed a commit to tenforwardconsulting/ that referenced this issue Mar 5, 2018
Copy link

I found a reasonable fix.

The user page only works as user page if the repository and the domain has the same name. So i changed my repo to mfedatto and my custom domain for changed from usor to project. This way my sameness.js pages stoped redirecting from (with 404) and came back working on

Copy link

@saintplay thanks for showing my netlify. It's pretty sweet!

Copy link

piranna commented Mar 25, 2020

I'm not using a custom domain anywhere, but I'm having the same issues, I had my personal web page in, and I created a gh-pages project on but instead of showing me the project content I get a 404 from my personal web site. Any idea?

Copy link

olivervorasai commented Sep 18, 2020

Here is how I fixed this issue for myself:

The Problem

  1. Have portfolio repository at
  2. uses custom domain at
  3. Created another project at
  4. Create gh-pages branch so Github Pages will host it
  5. my-new-project should be accessible at
  6. it is automatically redirected to and causes 404.

The Solution

  1. Rename the repository to
  2. should now be available at
  3. is still working, subsequent projects should get standard Github Pages urls without custom domains.

Copy link

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 redirect to or having it stay where it is. It's frustrating to me that we even need to find an alternative solution at all.

Copy link

Ark-kun commented Aug 29, 2021

I have to jump through so many hoops because of the inability to disable the redirect.

The redirect makes my users permanently lose access to their data.

I have built a client-side progressive web app and published it using GitHub Pages:
The user create ML pipelines using my app and they're stored in user's local storage (IndexedDB).

Recently I've bought a domain name to use for the app:

However when I configure the GitHub Pages to use the custom domain, the original address ( becomes inaccessible.
This prevents any of my users from accessing their data which is stored for the origin.

I wish I could disable the redirect to the custom domain in the settings.

Being able to add URL parameter like ?disable_custom_domain_redirect=true would have solved some of my problems as well.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet

No branches or pull requests