Redirects are not working

I have published a React app and it has some posts on clicking the details button on a post opens a new page on which the name of the post is written. But the new page is not opening else an error is showing, i.e., Page not Found - Looks like you’ve followed a broken link or entered a URL that doesn’t exist on this site.

Netlify site is -

Please refer to Create React App docs to deploy to Netlify: Deployment | Create React App

I have multiple endpoints on this site which are not working.

Like these -

This is the issue I’m trying to solve which does not solve by putting a redirect to index.html

Did you add a _redirects file? Where did you put it? Does the build log show the redirect was processed?

Is this the navigation for the project

  <li onClick={() => closeNavbar()}><a href='/about'>About us</a></li>
  <li onClick={() => closeNavbar()}><a href='/internships'>Internships</a></li>
  <li onClick={() => closeNavbar()}><a href='/events'>Events</a></li>
  <li onClick={() => closeNavbar()}><a href='/hackathons'>Hackathons</a></li>
  <li onClick={() => closeNavbar()}><a href='/contact'>Contact Us</a></li>

As React Router is in use, instead of using achor (<a>) use <Link>.

Hi, @amanmakhija. The single-page application (SPA) redirect rule is the fix for this issue. You have not tested this solution yet. You haven’t made any new deploys since making the first post in this topic and none of your previous deploys have any redirect rules at all.

If you do create the SPA redirect rule, it will fix this issue. If there are other questions or concerns, please let us know.

1 Like

Hi @amanmakhija, I’m on the Documentation team at Netlify.
Thanks for raising this question. We’ve made some recent updates to our React on Netlify documentation, including a notice about including a redirect for this type of single page app (SPA). Hopefully this will help users in the future.

1 Like