Unable to proxy a blog from a different gitlab repo (to the same custom domain)

Hello. I’m trying to deploy a separate blog repo to my customdomain.com/blog - exactly as described here: [Support Guide] Can I deploy multiple repositories in a single site?
In the existing parent website I created a ‘_redirects’ file (there was no netlify.toml file) and added the below code:
/blog/* https://blog-site.netlify.com/blog/* 200!

And in the blog’s repo I created a new directory called ‘blog’ and moved all the existing files and directories inside the ‘blog’ directory [so for instance the most basic file path is repo-name/blog/.editorconfig]

However when I go on customdomain.com/blog it’s not finding the page The blog site and the existing website are both on Gitlab and deployed on the same Netlify account. They’re both Gatsby sites and the blog is just the basic Casper theme starter if that helps. Any troubleshooting pointers or things to check?
(I’m generally new so could be making a really noob mistake too fwiw)

Hi @ak9, it’s hard to say exactly why it’s not working without knowing which site it is but I think perhaps your _redirects file was not included in your public/ (build) folder during deploy. Did you make sure to put the _redirects file in the static/ folder or if not, did you make sure to copy the file to public/ during your build process?

I added it to what I think is the root directory (Screenshot attached). The static directory only has a further subdirectory called ‘images’ which has a single image

@ak9, it would help to be able to examine the actual site at Netlify. Would you please send us a link to where the site can be found?

If you would prefer to send this information privately, please let us know and we can arrange that.

sure. can I please send you both sites privately? (the existing website and the blog site)

Counterproposal: You can send us the API ID publicly (from the site’s general settings page). This ensures that whomever on our team is next available (Luke for instance did not work today) can check things out.

But, you may not need to - that _redirects file is not in your publish or static directory, so it definitely won’t work. Please follow Dennis’ advice about where it should live:

Did you make sure to put the _redirects file in the static/ folder or if not, did you make sure to copy the file to public/ during your build process?

Thanks dennis, luke, and fool :slight_smile: The redirect is now working

That being said, the blog site is still not deploying from the blog subdirectory. It’s a gatsby site so I added pathPrefix: /blog, to the gatsby-config.js file, and used the following build command: gatsby build --prefix-paths on Netlify. Am I missing something else?
49a4cfbf-fd97-4450-80a0-71e2fcc91717 is the site’s API ID fyi

Couldn’t really advise at the level of how to configure gatsby to put everything in blog directly. My workflow would be like this:

  1. build site normally, ensuring that all links are relative (instead of “/asset.png” “asset.png”)
  2. after building, move everything to a blog subdirectory
  3. deploy the directory with blog in it, at the root
  4. proxy to the blog site which should now work.

I have a blog that runs at, for example https://blog.xyz.com, and the marketing site at https://www.xyz.com. The redirect from https://www.xyz.com/blog/ is working fine. It looks like this-
[[redirects]]
from = “/blog/*”
to = “https://blog.xyz.com/:splat
status = 200
So what do I do with the existing blog site- https://blog.xyz.com. This is still available. Do I have to remove the subdomain ? Search Engines can still find it.

You can use canonical tags: