1Option 2: .htaccess
2
3<IfModule mod_rewrite.c>
4 RewriteEngine on
5
6 # Don't rewrite files or directories
7 RewriteCond %{REQUEST_FILENAME} -f [OR]
8 RewriteCond %{REQUEST_FILENAME} -d
9 RewriteRule ^ - [L]
10
11 # Rewrite everything else to index.html
12 # to allow html5 state links
13 RewriteRule ^ index.html [L]
14</IfModule>
1Option 1: Virtual Host
2
3<VirtualHost *:80>
4 ServerName my-app
5
6 DocumentRoot /path/to/app
7
8 <Directory /path/to/app>
9 RewriteEngine on
10
11 # Don't rewrite files or directories
12 RewriteCond %{REQUEST_FILENAME} -f [OR]
13 RewriteCond %{REQUEST_FILENAME} -d
14 RewriteRule ^ - [L]
15
16 # Rewrite everything else to index.html
17 # to allow html5 state links
18 RewriteRule ^ index.html [L]
19 </Directory>
20</VirtualHost>
1RewriteEngine On
2# If an existing asset or directory is requested go to it as it is
3RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR]
4RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d
5RewriteRule ^ - [L]
6
7# If the requested resource doesn't exist, use index.html
8RewriteRule ^ /index.html
9