React not working in netlify

Hello I have a problem, when I refresh the post page of my website or when I enter from outside the web with a link, netlify sends me to page 404
but if I enter from the url https://kagarisoft.com, and then I go to the post page, it loads me perfectly.
I think the problem is not the redirects on my website, but it is netlify.
I tried to enter other websites created with react and when reloading them the same thing happens.

Hi, @Neyunse, I replied to your tweet about this here:

https://twitter.com/Neyunse/status/1307901463608397824

My response was to say that the solution is here:

The solution is to use the following redirect rule:

/*    /index.html   200

That rule is the solution for this issue.

Did you try creating the redirect rule? If so, did you add it in netlify.toml or using a file named _redirects?

If there are any questions about creating this rule, first please read the documentation here:

Then if that doesn’t work or if there are questions about how to create the rule, please let us know.

I created it in a _redirects file and it didn’t work, I put it in build/.
I don’t think it’s a problem with my website, a few weeks ago it worked perfectly.
This is another website that I use, https://rosesoflove.kagarisoft.com/introduction and it has the same problem. if you enter this url you will get 404 and in the root it also has a redirect file

Hi, @Neyunse. Did you read the top of the page in the deploy details page? It says this:

No redirect rules processed

This deploy did not include any redirect rules. Learn more about redirects.

You can see the contents of the build directory by downloading the deploy from the deploy details page with the button in the screenshot below:

download-deploy-button-small

This download also confirms that there is no _redirects file found in the publish directory. The issue isn’t that this redirect doesn’t work. It will work once it is there. The issue now is that the redirect is missing.

Why is it missing? That I don’t know. This is a private repo so I cannot clone it myself to test.

Do you want to make the repo public while we troubleshoot? If not, you might instead append " && tree" (no quotes) to the end of the build command. This would print all the files and directories to the build logs before the build ends and let you see what files exist at Netlify when the build is complete.

​Please let us know if there are other questions about making that file part of the site deploy to get the redirects processed.

It was solved or well I think so, when reloading the page I get blank but I no longer get 404

hello @luke I think I’ve got a similar problem to @Neyunse where the react part of my website is not working. The exception in my case that I’m using Nextjs and exporting the website statically.

I’ve posted about the problem in here , any ideas on how to get this sorted.

@luke the problem I think is because I am using route article/:id,
since now the page shows me blank when reloading it or when entering from a link.

example: https://kagarisoft.com/article/3

<Switch>
            <Route path="/" component={Articles} exact />
            <Route path="/article/:id" component={Article} exact />
            <Route path="/category/:id" component={Category} exact />
          </Switch>

In reload page or when entering from a link.

I’m using apollo and graphql.

I got my blog code from this github repository, the only thing I did was change the design.

While this is a good questions, @Neyunse, it isn’t a question about Netlify itself. It is a questions about how your site code behaves in a web browser.

If an asset isn’t being sent by our CDN to the browser or if it is sent but sent incorrectly, those would be issues that our support team can and will assist with. Those would be a questions about what Netlify’s systems do.

In this case, however, this is a question about what the site javascript does when the page is refreshed and that is your custom code. Custom code and third-party code is not something our support team troubleshoots. Custom code is not even covered for Enterprise customers (unless they have a custom support contract which specifically includes that level of support). There is more about this in our scope of support documentation.

You are free to ask questions about custom code here and other community members may be able to assist with this. These types of questions are welcome but our support team doesn’t answer them.

If you are seeing incorrectly sent responses to HTTP requests, please let us know and we’ll be happy to troubleshoot. Likewise, if there are any questions about what is and is not covered by the scope of our technical support, please let us know.

@Neyunse I was trying to find a solution to your problem, but I quickly noticed that this is not a Netlify issue, if you open the developer tools when you navigate directly to https://kagarisoft.com/article/3 you can see few errors, basically the data is not loading properly, so the issue is with your app, as soon as you fix the data fetching problem, everything should work fine.