My FeedDiscussionsHeadless CMS
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more

React app on server while refreshing the page shows 404 page

Sivabalan's photo
Sivabalan
·Jul 16, 2018

I am build the react app using the create_react_app. Now i move the build to the server and run the app using npmjs.com/package/serve. My app will load the data from the apis. When i refresh the page it shows 404 page not found error. Also i tried with npmjs.com/package/http-server

When i was some page /dashboard and refresh the page it shows 404. Now i have to go to BASE_URL/ then only it works. But in my local when i refresh everything works.

This is my package.json

"react-dates": "^17.0.0",
"react-dom": "^16.4.0",
"react-i18next": "^7.7.0",
"react-redux": "^5.0.7",
"react-router": "^4.2.0",
"react-router-dom": "^4.2.2",
"react-scripts": "1.1.4"

And i use apache on my server.

I think this is the problem not with my code. If you guys know anything about this, please help me.