The website is deployed but page not found error persists when refreshing or redirecting
This is the site link https://tubular-concha-020db1.netlify.app](https://tubular-concha-020db1.netlify.app/
@dharmanjistha12 See:
Additional explanation:
Thank you for your help. I have now included _redirects file in my deploy folder with /* /index.html 200 in it still the problem remained that is when I am registering I am not redirected to home page and it says page not found. But the same way works fine when i run the app in localhost
@dharmanjistha12 It’s most likely that you just haven’t done it correctly.
For example, I’ve seen several people say “I’ve done it and it doesn’t work”, and most of those had put the _redirects
file in the root of their repository, rather than ensuring it was in their Publish directory… in all instances once they put the file in the right spot, it did in fact work.
Running the app via a development mode on localhost isn’t a good comparison. To see what you’re deploying to Netlify you should check the output of your build command.
Just double check everything, but if you continue to encounter issues you can provide access to your repository.
@dharmanjistha12 The repository supplied doesn’t build for me due to:
Module not found: Error: Can't resolve '../../../utils/config' in '/home/centipixel/Labs/MERN-app-frontend/src/components/home/postCards'
It also doesn’t contain a _redirects
file at all.
I presume when you tried it, you had tried manually adding a _redirects
file to a “drag and drop” deploy?
I have not uploaded the config.js in github since it contains the base url.
I have uploaded this builds folder under frontend while deploying. It is containing the _redirects file. Here’s the link
@dharmanjistha12 Can you upload an appropriate config that allows it to build?
It wouldn’t need to contain real information, just enough for the build to execute, so the actual output folder can be checked to ensure it contains the _redirects
file.
I understand you’ve put the _redirects
file in the /build
folder, but as I cannot execute the build, I cannot tell how that relates to the output. E.g. If that file is copied over, or if it gets deleted/overwritten.
@dharmanjistha12 As I’d indicated was probably the issue, it looks like your _redirects
file is in the wrong spot for your build, which is causing it to not be in your final output.
You’ve put it in your build
folder to begin with…
But after you run npm run build
…
The build
folder is emptied and recreated, which means the file is no longer there…
You should put it within the public
folder so that it’s copied in as part of the build.
Which is as per the documentation of a create react app:
@dharmanjistha12 I don’t know what you mean by “that also didn’t work”, because that’s definitely worked.
If you go to a random page now, you’ll find that it doesn’t display the default Netlify 404 page anymore, it displays one served by your react site.
For example:
https://resilient-pika-0d04df.netlify.app/this-does-not-exist
Hitting refresh on a page like https://resilient-pika-0d04df.netlify.app/signup now also works.
By that I meant my problem that I mentioned before in this comment https://answers.netlify.com/t/page-not-found-error-looks-like-youve-followed-a-broken-link-or-entered-a-url-that-doesnt-exist-on-this-site/89603/3?u=dharmanjistha12 was not resolved
That’s an additional request separate from your first one, your first one is solved as per all the information I’ve given you.
You will ultimately need to debug your own project, since “how your project works” is outside of the scope of support.
As a pointer though, your registration form tries to POST
to a path of /api/register
and presumably you quite simply do not have anything there.
If your backend is hosted elsewhere, you will either need to adjust that URL to point at the actual backend, or add additional proxy rules to your _redirects
file.
You should read the documentation here if you’re unfamiliar with it:
Thank you for all the help
Just met same problem, and your post helped me very much! I some body have the same issue, just create file _redirects and add /* /index.html 200
. File should be in folder Public. I use Vite + React.
thanks a lot! It worked
https://66f3dd4a3305781618646bc3--sprightly-lebkuchen-f69e0b.netlify.app/ im fa\cing same isues even having_redirects in my build folder so kindly resolve it @nathanmartin @deepakkumaravelu
@ridafatima7 Create your own thread on the forum with enough details that someone can assist you.
Your current post attempts to hijack an old thread, which is already solved, and doesn’t provide enough detail for anyone to help.