I use angular.js and slim framework for api. My directory structure is
root/
api/
frontend/
.htaccess
In root directory I have .htaccess file
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /
RewriteCond %{DOCUMENT_ROOT}/frontend/$1 !-d [NC]
RewriteCond %{DOCUMENT_ROOT}/frontend/$1 !-f [NC]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /frontend/index.html [L]
RewriteCond %{DOCUMENT_ROOT}/frontend/$1 -d [NC,OR]
RewriteCond %{DOCUMENT_ROOT}/frontend/$1 -f
RewriteCond %{REQUEST_URI} !^/frontend/ [NC]
RewriteRule ^(.*)$ /frontend/$1 [L]
It work ok but when I try to get file that doesn't exists apache returns content of index.html and status 200 OK instead of 404 so code like this
<script src="/thisFileDoesntExists.js"></script>
will return content of index.html. How to retun 404 for wrong files?