hello first of all. I need some help.
firstly ı made a bin site but when i save text and i open random generated links i got 404 error.
I saw in the help forum that this is a problem with React, but I couldn’t find a suitable solution for me.
site link: https://paste.emojipati.xyz/
github link: GitHub - EmojiPati/PatiBin: Your Best Way to Save Your Codes or Texts.
@emojipati This answer also applies to you:
@blogfreerecipe This is occurring because your site is a react based SPA (Single Page Application).
When you visit the site via the root / it is automatically loading the index.html which is your application, and then when you visit other pages you never actually leave the index.html page (it just looks like you do).
So /recipeDetails/110133d3dd574821a9ab17b9d160d06d loads in additional data and simulates a browser page change.
However when you make a fresh request for example by going to one…
@emojipati I can see you’ve added a _redirects
file, but your problem is your _redirects
file is in the root of your repository, it needs to be in the root of whatever you have set as your Publish directory
hmmm
ı got this deploy log.
A “_redirects” file is present in the repository but is missing in the publish directory “build”.
ım newbie in react how can ı add _redirects file in my render folder.
render folder is “build”.
@emojipati How you get the file into the Publish directory
is ultimately up to you or the system you’re working with.
In your case, you likely want to leverage the public
folder.
Looking at the docs for ‘Create React App’…
If you put a file into the public
folder, it will not be processed by webpack. Instead it will be copied into the build folder untouched.
Just drop your _redirects
file into /public
, so it is /public/_redirects
1 Like
I’m trying right now, please give me a minute.
There’s no rush, I’m just trying to give you some speedy help
You can remove the _redirects
file from the root of the repo too, once you have the one in /public
Doing so will just prevent any confusion in future, where you may open your project and edit that file and then wonder why it doesn’t take effect.
It Work Thank you for helping me.
Best Moderator “nathanmartin” <3
Great work!
I’m not a moderator, and I don’t work for Netlify.
I’m just a developer and have used Netlify since before it was Netlify.
I just figure getting a quick answer is better than waiting.
1 Like
You Won My Heart.
If I Was The Boss I Could Give You A Prize Due To The Quick Response Principle.
Thanks again…
SamO
January 31, 2023, 3:17pm
12
Hi @emojipati welcome to the forums and i’m glad you’re here. I’m glad you were able to get help from our community. (: