# Redirects using create react app

**URL:** <https://answers.netlify.com/t/redirects-using-create-react-app/89676>\
**Category:** Support\
**Tags:** redirects, netlify-newbie\
**Created:** [April 9, 2023, 9:16pm UTC](https://answers.netlify.com/t/redirects-using-create-react-app/89676 "2023-04-09T21:16:40Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![jasiqli](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/jasiqli/32/38220_2.png) [@jasiqli](https://answers.netlify.com/u/jasiqli)\
**Post date:** [April 9, 2023, 9:27pm UTC](https://answers.netlify.com/t/redirects-using-create-react-app/89676/2 "2023-04-09T21:27:26Z")

</div>

> [@NetoSena](#):
>
> Inside the `public` folder I have the `netlify.toml`,`404.html` and inside the `netlify.toml` has  
> `[[redirects]] from = "/*" to = "/error" status = 404`

As mentioned in the [File based configuration](https://docs.netlify.com/configure-builds/file-based-configuration/) documentation, a `netlify.toml` file should go at the root of the repository. A `_redirects` file as mentioned in the [Static routing overview](https://docs.netlify.com/routing/overview/) goes in the publish directory—_which in the case of React means putting it in the `public` directory._

For an SPA like React, especially if using React Router, you will generally want a single rule as outlined in [[Support Guide] Direct links to my single page app (SPA) don't work](https://answers.netlify.com/t/support-guide-direct-links-to-my-single-page-app-spa-dont-work/126)  
**`netlify.toml`**

```auto
[redirects]
  from = "/*"
  to = "/index.html"
  status = 200

```

**`_redirects`**

```auto
/* /index.html 200

```

---

_[View the full topic](https://answers.netlify.com/t/redirects-using-create-react-app/89676)._
