Configuring .htaccess file to serve angular and api routes
<p>I am lost with the configuration of my .htaccess file. I have a website serving the client part (angular.js app) and api routes, which are handled with the slim framework.</p>

<p>My html pages are served with the ui-router, but in order to handle the page refresh, I have to do an url rewrite.</p>

<p>That's my file so far :</p>

<pre><code>DirectoryIndex index.html index.php

#
# Redirect all to index.php
#
RewriteEngine On

# if a directory or a file exists, use it directly (static assets)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

#if route starts with "api", route to index.php (slim framework)
RewriteRule ^api/ index.php [L]
#else (it means we are serving the angular routes)
RewriteRule ^(.*) /index.html [NC,L]
</code></pre>

<p>It's, of course, not working. The real problem is that I don't know if my logic is good at first (or I am far far far far away...), and then how to write it (I am new to apache syntax and I don't really understand everything).</p>