Keep getting 404 error for all routes aside the base url

Site Url: https://unique-mandazi-f9e328.netlify.app/

I have a react app that has some paths, When I try this https://unique-mandazi-f9e328.netlify.app/sales directly from the browser for example, it shows 404. but if i try the same within the app say via a button, it is able to navigate to the https://unique-mandazi-f9e328.netlify.app/sales.

What have I tried: I have tried checking the Published Deploy and I can confirm that there is an index.html file. I am not sure what next steps to take.
Thanks

Hi @kassim, welcome. If possible can you share a repository of the site you are trying to deploy for me to help with the debugging.
Thanks.

Thanks for the reply, fijd the repo below. Since it’s private, u may need to be granted access to it.

https://github.com/qaasimahmad/TheGrandRealtyUI

Hi @kassim, since the repository is private I cannot view. You can create a minimal production repository of your site without any private information and then share.
Thanks.

Okay, I’ll work on this and share.

1 Like

Hi there. I have a prod build. You can access it here

Hi @kassim, thanks for sharing.

May I know the button on the site you are referring to?

Screenshot 2022-11-10 at 15.14.09

CLick on the Arrow shown on the Homepage to move to the search page, then select either of the buttons shown in the screenshot.

Expected result BUY would change the url to https://unique-mandazi-f9e328.netlify.app/sales. while RENT will change the url to https://unique-mandazi-f9e328.netlify.app/rental

Th issue is that if you go to the same directly without going via those buttons, the result is a 404 error.

There is also a path /verify-email, it also returns a 404 instead of redirecting to the HomePage. however on localhost, it works fine.

Hi @kassim, kindly create a _redirects file inside the /public folder like /public/_redirects.
After paste the code below into the _redirects file.
Your site should now work as expected when you explicitly visit the paths in the browser.

/* /index.html 200

Let me know the outcome.

Thanks.

Alright, i’ll try it out shortly and revert

1 Like

It worked like Charm👌. Thanks

1 Like

Hi @kassim, glad to know the suggestions helped to resolve your problem.
Thanks.