PLEASE help me fix after i deploy it says page not found im first time to deploy replit app here
this is my build settings
PLEASE help me fix after i deploy it says page not found im first time to deploy replit app here
this is my build settings
@abganzon You can check your build log to see if everything ran as you expect.
Then use the Deploy File Browser to see what files you deployed.
You must have an /index.html
file, (or a function that handles that route).
i succesfully deploy and added the file public/_redirects but still page not found but its not in the deploy file browser or i put the file inside client/public/_redirects
If you check your screenshot, you’ll see those files have been deployed in a folder of /public/
Which you probably don’t want.
As to load that index.html
file you would need to go to:
{yoursite}/public/index.html
or {yoursite}/public/
Not {yoursite}
or {yoursite}/index.html
The _redirects
file needs to be in the root of your publish directory, as per the documentation:
https://docs.netlify.com/routing/redirects/
Save a plain text file called
_redirects
without a file extension to the publish directory of your site.
i got it working i dont know what i did but thanks for the help cheers
@abganzon Your issue was never the _redirects
file.
This is because you weren’t getting the 404
error due to having or not having _redirects
.
You were getting the 404
due to not having an /index.html
file in the root of your dist
output.
As I previously mentioned, the file you showed in your last screenshot was /dist/public/index.html
The _redirects
file and the rule you were trying to apply isn’t a magic fix for ‘all 404’s’
It’s for Single Page Applications (SPA) to route direct requests from sub-pages to the main page.
Since they frequently only have an /index.html
‘entry point’ for the application.
It means if someone requests /about
they still ultimately load /index.html
At which point the application determines what it should show for /about
If you don’t have an /index.html
page, you can’t redirect to it.
Just like if you didn’t have a /cat.html
you couldn’t redirect to that.
It would just create a redirect that always resolves to a 404
.
That said, your redirects were probably never being applied.
In your most recent screenshot you have _redirects
in your repository root.
This isn’t the correct location for your build.
The _redirects
file needs end up in the root of your ‘publish directory’
If you were publishing dist
this means it would need to be in dist
when you build completes.
The easiest way to confirm this is to run your ‘build command’ locally and see what it outputs.
You just needed to update your/build settings to ensure the output going to dist
was correct.