rewrite rules for apache 2 to use with angular js
Here's something to get you going (put this inside your /.htaccess file):
Options +FollowSymLinks
IndexIgnore */*
RewriteEngine on
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteCond %{REQUEST_URI} !/api
# otherwise forward it to index.html
RewriteRule ^.*$ - [NC,L]
RewriteRule ^app/. /app/index.html [NC,L]
NOTE: For newer Apache versions see also the next answer, which uses the much easier FallbackResource
The accepted answer to this question is outdated. You can now use the FallbackResource directive in your conf file with Apache 2.2.16+.
FallbackResource /app/index.html
If you want the FallbackResource directive to ignore the "/api" routes:
<Directory /api>
FallbackResource disabled
</Directory>