Redirects not working from outside of react website

Hello. Jr. Web Developer here so be gentle please.

I’m making a website using react

I’m building a react website using Netlify and pushing it to github GitHub - benjaminfmoore/crithit and while the site is ugly, most of it works (The form is just for show while I work on this issue lol).

My problem that I’m having is that Since it’s a single page application (loading components and routing in from the single App.jsx file. Whenever I click around inside the site I can connect to outside sites as well.

The problem arises when I try to click back or refresh. I get the standard 404 error. I put a _redirect file in the build folder as well with (/* /index.html 200) in it. Still got nothing. I’m not sure where I’m going wrong so I figured I’d hit the forums.

Thanks in advance!

Ben

Hey there!

In your last deploy log – Netlify App – I can see that no redirect rules were processed. When you build your site, make sure that the redirect rule is correctly applied! The making redirects work for you guide might help :slight_smile:!

Hi. So I put in 2 new sets of redirect rules now and it’s still not working,.

I did the _redirects file along with a .toml file as well.

Still getting the same error. I made sure to put them in the base folders (Where the index.html file is sitting) and I checked my build logs and it says “Two redirect files” are up and going.

I’m sure I’m putting something wrong somewhere and very close. But close doesn’t cut it here lol.

So I ran through my code some more and found out the issue.

My routing in my app.jsx file had “Exact” in it. I found out that exact should only be used for the primary page.

Sorry for causing so much trouble. But now I learned and know…and knowing is half the battle!

But the great thing is now I also know that I can go bug this place for help which is waaaay nicer than stack overflow lol.

1 Like

yay! And thank you for the compliment! I built this place and set out to create a forum where everyone would feel welcome and included - regardless of background and technical expertise, and would feel encouraged to share what they learn and fix as they go along. Seems like we are succeeding :muscle: