Apache
Change the VirtualHost configuration (typically found in /etc/httpd/conf.d\vhosts.conf
) by adding the following Rewrite*
lines:
General Apache virtual host configuration information can be found here: Configuring Apache Virtual Hosts
<VirtualHost *:8080>
ServerName example.com
DocumentRoot /var/www/httpd/example.com
<Directory "/var/www/httpd/example.com">
...
RewriteEngine on
# Don't rewrite files or directories
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
# Rewrite everything else to index.html to allow html5 state links
RewriteRule ^ index.html [L]
</Directory>
</VirtualHost>
This tells Apache to serve any files that exist, but if they don't exist, just serve /index.html
rather than a 404: not found
.
react-router
History Reference: Configuring Your Server