Netlify running not excepted - reactjs

when i running my react app on localhost, it return to page, my url is: http://localhost:3000/danh-muc/1/1-kiem-thu-phan-mem
but when i run it on my netlify, it return page 404, my url on netlify is:
https://flamboyant-montalcini-da8726.netlify.app/danh-muc/1/1-kiem-thu-phan-mem
it is the first time i use netlify. In addition to, my custom page 404 was lost, How to fix this problem?

i have a answer for this question, i add file "_redirects" in public folder with content:
/* /index.html 200

Related

Sanity Slug works in localhost but not on Netlify

So I am building a react and sanity blog website. When I run the app on localhost, my blog post slugs work, copying the slugs and opening in a new tab works but when I deployed it on Netlify, I get a 404 page, what going on?
Thank you for your time
Try this, it worked for me
In your public folder, create a "_redirects" - without the quotes, file and add the following lines of code
/* /index.html 200
Hope it works for you.

React, after deployment on netlify routes give 404 page not found on refesh

I am trying to learn how to fix the following issue.
After deploying my react app on netlify, when I refresh any of my routes at
https://candid-cobbler-cd2c3e.netlify.app/ or manually load https://candid-cobbler-cd2c3e.netlify.app/red it gives me a 404 page not found error.
The site works find if I use buttons to navigate.
Solutions that I have tried so for :
_redirects was added to the root folder with /* /index.html 200 built and re-deployed. Did Not Work
netlify.toml was added to root folder [[redirects]] from = "/*" to = "/" status = 200
built and re-deployed Did Not Work
Take a look at my files : https://github.com/swappybizz/routing_refresh_on_deployment/
There is a useful tutorial by hBlev : https://www.youtube.com/watch?v=e6qXUS3C550 where at 10:00 , it has been explained the following :
Netlify serves only Index.html
Everything in the Public directory gets build and src gets bundled.
The _redirects has to be in the Public directory for the routing to work on refresh or manual loading
The statement /* /index.html 200 is a to from statusCode
and the * represents all possibilities and it is going to redirect them to index.html which is actually the only thing served. Buth the status code 200 helps keep the /path and not letting it redirect to the url but Render while keeping the path
details could be found [here]:https://docs.netlify.com/routing/overview/
Same site was redeployed to https://teal-mermaid-ada4e6.netlify.app
and now routes could be refreshed or directly loaded i.e by clicking https://teal-mermaid-ada4e6.netlify.app/red

Netlify page not found 404 after clicking a button

I'm new to here, just have a question and want to solve it. I have deployed my app on netlify, everything works fine at localhost, but when I tested it on netlify with a function. It threw an error like this.
The page not found but when I tried reloading with that same URL, It still accessed. I use heroku for deploying api and netlify for client.
So what is the problem here? Can anyone help me, thanks!
My app for anyone would like to test: http://myblogapp123.netlify.app
create a file inside the public folder. Name it "_redirects"
inside _redirects file, paste this: /* /index.html 200
Then build your project and deploy it again. Hopefully, It'll work.

If I refresh the browser my react app are being page not supported error message

I'm new in react app development, I just build my practice app and deployed it through Netlify. I can visit my app and everything is fine till I refresh my window. Refreshing the window comes with an error page not found. what should I do to solve this problem?
You may need to look at providing a _redirects file in your root directory. See https://docs.netlify.com/routing/redirects/
For example,
/* /index.html 200
As cra is single page application, you need server setting to redirect everytime to index.html,
You might want to check this link
https://www.netlify.com/blog/2020/04/07/creating-better-more-predictable-redirect-rules-for-spas/

404 error when reloading reactjs site deployed on github pages

I recently deployed a reactjs website on github pages using the custom domain -https://titanmarket.co.ke/.
The website works as expected but returns a 404 error when you reload a page. Usually, a user would expect the current page to be displayed on refresh.
Any insight on this would be great.
This may answer your question link Reference, Also see this
Super easy solution for Github pages reload 404 error.
in the src/public/ index.js file add this script below to the bottom body:
Index.js
https://github.com/rafgraph/spa-github-pages/blob/gh-pages/index.html
Create a 404.html file in the root directory:
404.html
https://github.com/rafgraph/spa-github-pages/blob/gh-pages/404.html
Read more:
Source:
https://github.com/rafgraph/spa-github-pages

Resources