Sanity Slug works in localhost but not on Netlify - reactjs

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.

Related

Netlify running not excepted

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

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.

Reactjs site doesn't load any sub pages other than homepage, hosted on Netlify

I hosted one of my website on Netlify. Site was built with ReactJS.
After deploying on Netlify, I can view the homepage but can't load any of the other pages.
Site works totally fine in localhost.
Is this a problem with routing?
I used react-router for routing.
Try to create a new file in your project public folder called _redirects then add this inside it
/* /index.html 200
its been solved here before Netlify does not recognize the URL params when using react-router-dom
Just found this blog post. This gives a good explanation.
Creating a file called _redirects in the public folder and adding this code
/* /index.html 200
solves the problem.
https://dev.to/rajeshroyal/page-not-found-error-on-netlify-reactjs-react-router-solved-43oa

Netlify doesn't display all website pages

I am using Netlify to deploy a website. It was built with ReactJS and locally everything works. After deploying it on Netlify only the landing page works.
The website is a simple static website for hosting my portfolio.
The main website is www.myname.com while projects are located on www.myname.com/project-name-case-study
Anything under www.myname.com/project-name-case-study leads to a "Page Not Found" screen. I'm just not sure where to even start here. I'm new to website deployment
Just figured it out. The issue was specifically related to React-Router. This freeCodeCamp article shows how to easily fix it.
As this article mentioned:
"Create a new file with the name _redirects inside the public folder of our project and add the following contents inside it:"
/* /index.html 200

React apps have stopped working on Github Pages - 404 Error

My React Apps were working perfectly on Github Pages until a few days ago, now they are all giving me 404 errors.
I'm not sure what to try, I haven't changed anything so I'm not sure why they're suddenly not working.
Here is a link to an example: https://github.com/paulmartin91/WikiSearch
It used to host a wikipedia search page, but now I'm getting the following...
"
404
File not found
The site configured at this address does not contain the requested file.
If this is your site, make sure that the filename case matches the URL.
For root URLs (like http://example.com/) you must provide an index.html file.
Read the full documentation for more information about using GitHub Pages.
GitHub Status — #githubstatus
"
It is working locally.
Thanks!
All fixed, I was using the github url 'https://github.com/paulmartin91/WikiSearch' as the package.json.homepage instead of the gh-pages url.

Resources