Support Forums

_redirect file is removed


I’ve added a _redirect file into my build folder. But when running the build, it gets removed.

I can use the URL routing when visiting the website from antoher deploy using an auto generated netlify.app domain but not with the custom domain.

Website with netlify.app url: https://relaxed-poincare-215540.netlify.app/

Website with custom domain: https://www.pixelcowboys.community/

The url routing not working is: Pixel Cowboys

Thanks in advance

Do you have a repo we can see? At the moment, I’m seeing just 1 redirect rule which is not relevant to the redirect you seem to be trying to use.

Hi @hmmmm

I cannot see a _redirects file anywhere in the git repository you shared.

If you put said file in build when you run the build script (e.g. npm run build) this directory and contents are overwritten by the new build.

If you put the _redirects file into the public directory, it is copied to the build directory as part of the build process.

It does not matter if you deploy from git, or build and deploy manually, the process is the same.

Well thank you for the reply. Seems like the run build catched the file. Will see if it works.

Hi again,

I’ve tried to add /* /index.html 200 to the _redirects, but nothing happens. I’ve tried a lot of different syntax, but still i get the 404. Problem seems to arise with the custom domain url routing.

Could you share the folder that you manually upload?

I believe it could be a routing problem on the DNS side from my domain provider. But i will upload. When i drop the folder here, the _redirects file disappears. I think this is due to it lacking an extension. But the file only contains the following line: /* /index.html 200

Could you create a zip of the folder and share it using some cloud storage like Google Drive?

I deployed the site and everything worked as I would expect, including the /mint path. If this is the same version you have deployed, I cannot see any reason why this path would not work with a custom domain.

Yes. As i mentioned higher up, the .netlify domain https://relaxed-poincare-215540.netlify.app/ works fine. I tried to ping the route /mint and didn’t get any answer. Therefore, i believe there is some problem with the CNAME or some DNS conf on the hosting side.

If there was a DNS issue with the custom domain, it would not simply affect a single path rather the whole domain would have issues.

Ok, then i cant figure it out. the build folder is the same and it is working from this deploy: https://relaxed-poincare-215540.netlify.app/ but not with the custom domain.

There is an issue with your DNS after all.

$ dig www.pixelcowboys.community CNAME

www.pixelcowboys.community. 3202 IN	CNAME	pixelcowboys.netlify.app.

Your CNAME is not pointing to https://relaxed-poincare-215540.netlify.app/. You need to change the CNAME, and set up the custom domain on the correct Netlify site.

Yes i figured it was the CNAME. I just changed it to point to the other. Lets see in while if it works.