Is it possible to deploy multiple repositories to the same domain?

If I have four GitHub repositories which I would like to deploy to various folders on my domain (e.g., one deploys to root, the others deploy to folders) is it possible?

If so, how do you prevent the root deploy from erasing subfolders?

You can’t do that directly, but this article shows the workflow you’d need to deploy multiple different netlify SITES and host them under subfolders of a single domain:

Thanks @fool and sorry if that Common Issue article is responding to this question, but I can’t manage to see how.

I have a similar setting to that proposed by @brenton. Specifically, this is what I would like to accomplish in my case:

  • The site I want for my root domain (name.tld) is a Hugo site hosted in its own GitHub repository (NOT the personal GitHub Pages one). This works fine.
  • I want to use just GitHub Pages to publish my other GitHub repositories (this is in order to simplify the workflow/workload). For this:
    • I can NOT set any custom domain for my personal GitHub Pages repo (, and then all my repos are accessible through
    • BUT I would like to use my custom domain name.tld for this, and be able to access them through name.tld/reponame
    • However if I set up my domain name as custom domain for my personal GitHub Pages repo (which is how GitHub uses it to serve all other repos as subdirectories),
      • GitHub complains that it is not set up correctly (obvious, because it is pointing to Netlify that deploys the main site from a separate repository), and
      • trying to access them through name.tld/reponame does not work, it returns a 404 page from the Netlify-deployed Hugo site, but
      • trying to access them through doesn’t work either, because my personal GitHub Pages site has a custom domain set up.

And this is how I am stuck at this. I would love to have a setup that allows me to

  1. Deploy the root hugo site in name.tld from a GitHub repository with Netlify, and
  2. have all other repositories (with published Pages) load as subdirectories of the main domain straight away.

So my first question is: is this possible? And how?

If the answer is no, I guess my only options are:

  • Somehow tell the main hugo site to load GitHub repos as subdirectories (how?)
  • Forget about having the other repos as subdirectories of my custom domain and just use the URL (which I really would NOT like)

Sorry for the lenghty message. I really hope you could point me in the right direction here!

Thanks in advance.

No need to apologize :slight_smile:

I was suggesting that the article I linked talks about how you stitch together multiple repos under one domain name, which is still my understanding of Brenton’s goal. You’ll have to use the proxying setup mentioned in the article to do this.

I can’t advise you on using github pages as part of the solution, but I guess you’ll want to proxy to them using that same functionality:

  1. configure your domain on netlify.
  2. deploy your other repo(s) on GH pages under a /whatever directory, and proxy /whatever/* to that page from Netlify.

That will accomplish your number 1 and 2 goals. If you don’t see how based on that advice, please provide a real URL that is an example, since I am pretty sure your github username isn’t username :wink: . Then I can give you an example config for that proxying.

1 Like

What made you think my username isn’t username? :stuck_out_tongue_winking_eye:

Your answer really put me in the right path. Specifically the Shadowing bit gave me the aha! moment that helped me get what I wanted:

By default, you can’t shadow a URL that actually exists within the site. This applies to rewrites using a splat or dynamic path segment as well as rewrites for individual routes or files.

Just for the record, in case someone is in a similar situation: I just proxied everything to my GitHub Pages URL with a splat, like so:

/*   200

and it works! Now everything in a URL after my custom domain (except the pages that actually exist on the Hugo site) gets proxied to my GitHub Pages published repositories. This will only be problematic in case I have a page in my Hugo site in a directory with the same name of a repo… which I don’t think will happen very often (and I see as a feature, actually!).


1 Like