RewriteEngine on
### FOR DEVELOPMENT ###
# Redirect all requests for non-existent files to /index.html. This is
# easier for development, but it can cause the application to lock up in
# some cases. (For example, if the app tries to load a non-existent HTML
# template, then Apache will serve up a second copy of the app, which
# will be nested inside the first...which can continue indefinitely until
# you get a stack overflow.)
# 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]
### FOR PRODUCTION ###
# To be on the safe side, it's better to explicitly allow those routes that
# are actually used in your application, and let requests for other URLs 404
# naturally.
# RewriteRule ^example index.html