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 which includes # and a random key. (We want it to encapsulate to something like http://example.com/about and not like http://example.com/#/about?_k=9yfmfq )
My webpack.config.js code -
module.exports = {
entry: [
'./src/index.js'
],
output: {
path: __dirname,
publicPath: '/',
filename: 'bundle.js'
},
module: {
loaders: [{
exclude: /node_modules/,
loader: 'babel'
}]
},
resolve: {
extensions: ['', '.js', '.jsx']
},
devServer: {
historyApiFallback: true,
contentBase: './',
port: 3000
}
};
Looking for a solution in apache2. Sorry for asking a noob question.