How can I add a _redirects file to my published directory?

I’m trying to solve the usual issue with SPA apps: when clicking on links in my navbar, I am not routed to my components and get the dreaded “Page Not Found
Looks like you’ve followed a broken link or entered a URL that doesn’t exist on this site.”

To this end, I want to start troubleshooting this by adding the _redirects file to my published directory. I have added _redirects to the root directory of my project (where index.html lives) and I get the following build message : ‘A “_redirects” file is present in the repository but is missing in the publish directory “dist”.’ I have moved _redirects to other directories in my repository, but in these cases, it is not noticed at all. How can I get this file into my published directory (“dist”) on Netlify? Do I need to create a special directory in my project? Thanks!

Site: https://main--lisflix-2022.netlify.app/
Full deploy log: Netlify App
Deploy Settings: Netlify App

Hi @Nekomimi-YT, thanks for the post.

$ parcel build src/index.html --public-url /

Took a look at your deploy logs and noticed you are using Parcel to build your site.

It’s possible your directory structure could be the problem or wrong configuration in your package.json file
If possible can you share the repository of your site for me to help you with the debugging?

Thanks.

Thank you for your help! My repository is here, building from the main branch : GitHub - Nekomimi-YT/Movie_App-client: A SPA with a simple and effective UI, developed using React, that allows users to create an account and interact with a movie information app..

Hi @Nekomimi-YT

I believe you need to use a plugin to accomplish this
~~https://www.npmjs.com/package/parcel-plugin-static-files-copy~~

I had thought parcel had (or had in a previous version) a built-in method, but perhaps not.

Also, you don’t need to explicitly pass the --public-url / as this is the default.

Apologies, the Parcel V2 plugin is

2 Likes