I have created a site using react js. It is working fine on my local system using browserHistory but not working on my production server. The first time it loads properly. When I refresh the page it gives me “page not found” error.

I have tried using hashHistory. It resolved my issue but I am looking for a better solution because I don’t want complex URL hashHistory gives.

My webpack.config.js code –

module.exports = {
  entry: [
  output: {
    path: __dirname,
    publicPath: '/',
    filename: 'bundle.js'
  module: {
    loaders: [{
      exclude: /node_modules/,
      loader: 'babel'
  resolve: {
    extensions: ['', '.js', '.jsx']
  devServer: {
    historyApiFallback: true,
    contentBase: './',
    port: 3000

Read more here: 404 error on react js application page when we reload/refresh


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: