Cannot deploy to custom directory

Hi everyone,

I have a Gatsby site that shall go in a subdirectory like /seo-newyork that I then address via a _redirects file in my home folder which has the entry
/* /seo-newyork/:splat 301!

The only issue is that the deployment to that deployment folder /seo-newyork does not work as the directory is not found.

My netlify.toml looks like this:
publish = “/seo-newyork”
command = “npm run build”
YARN_VERSION = “1.3.2”
YARN_FLAGS = “–no-ignore-optional”

Kind regards

Hi, is your code publicly accessible? If not can you give us your full folder structure?

Somebody posted a similar issue yesterday, unfortunately i can’t find the thread, but the following solution was posted:
In netlify.toml this was the original setup:


but was changed to


I don’t know for sure but i suspect that there was a recent change in how the base was handled in Netlify CI.
Without knowing your full folder structure i would advise you to either specify the base(if you have a base folder) or set the full path on the publish.

Hi zitnvrs,

thanks for you reply.
I tried to play around with what you suggested.
But that could not solve the issue.

Yes the repo is available at
I have the impression that I already have to put everything in a subdir called seo-… within the github repo.
I thought this could be possible with the gatsby build command… but I only found some discussion in a Gatsby forum where they said there is no reason to implement such…

Maybe you have another good idea…

Still searching for an answer,


Hello @wilnauem,

Note that the publish directory is where our buildbot will look for your site. It’s not the folder where your site will deploy to.

That said, by default your gatsby site will build in to the ‘public/’ folder. You’ll want to copy the contents of that folder into another folder names ‘seo-newyork/’ to accomplish what you want.

Your build command should look something like:
gatsby build && mkdir new-public/seo-newyork && cp public/* new-public/seo-newyork

You’ll also want to make sure your publish directory is set to ‘new-public/’. These two changes should accomplish what you want.

1 Like

Hi Dennis,

thank you very much for having taken the time.
This was the answer I was looking for!!!

Thanks a lot,