_redirects doesn't seem to be working

Hello,

I’m getting the usual 404 Page not found error when refreshing the page on my react app. I placed my _redirects file at the root of my project containing:
/* /index.html 200

You can check out the repo here.
You can check out the live site here.

I’ve successfully fixed this issue in previous projects but for some reason it’s not working with this one. Any help would be appreciated. Thanks.

I added the _redirects file but also copy/pasted the code to play.netlify.com. This outcome, when successful, I copy/pasted it to a netlify.toml file and this worked for me.
So eventually I have both, yes.

Great, that seems to have fixed the issue on my live site. When I run ntl dev now in my local dev mode though I get Rewrote URL to /index.html with nothing showing up. Is there a way to only run the redirects in my netlify.toml file in production mode or only when deployed to netlify? Thanks!

Hi @nicmeriano, sorry it’s not immediately obvious why you don’t want redirects running in local development. Can you clarify? Thanks!

Hi @futuregerald, thanks for checking in. Without configuring a .redirects file and/or my netlify.toml file, everything works fine during local development but I get the 404 error when refreshing my live site. By configuring the .redirects & toml file I’m able to fix redirect issue on the live site but on local development the page no longer loads and all I get in the terminal is Rewrote URL to /index.html on every refresh. Note that this only happens when I run ntl dev (not npm run start) as that’s how I’m able to test out my lambda functions.

I hope that was slightly more clear, and thanks again for your help.

First off just to clarify - please make sure - it’s _redirects not .redirects.

The latter will do nothing :slight_smile:

As far as I can tell, the redirect is working on the live site - for instance, you have no file at /companies.html or /companies/index.html but this URL loads your index file as expected:

https://www.entrydevjobs.com/companies

Perhaps you managed to work out a solution in the meantime?