I am trying to setup apache 2.2 with AngularJS with an almost exact structure as the one from the following closed question.
rewrite rules for apache 2 to use with
I had this same issue. But I'm ignorant in mod_rewrite so had to Google a lot.
I found the solution in this email:
https://groups.google.com/d/msg/angular/GmNiNVyvonk/mmffPbIcnRoJ
So I think your .htaccess should look as follows:
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
RewriteRule ^.*$ - [NC,L]
# otherwise forward it to index.html
RewriteRule ^app/(.*) /app/#/$1 [NC,L]
Notice the (.*) and the #/$1
Note: you MUST use absolute paths in your includes CSS, JS, etc. if not you are going to get the error:
resource interpreted as script but transferred with mime type text/html