ui-router html5mode not working with extend url or url with params
<p>First, I had this issue, <a href="https://stackoverflow.com/questions/35019805/angularjs-ui-router-html5mode-not-working-on-reload?noredirect=1#comment57770218_35019805">link</a>, and after some reading and some tests I noticed a problem with the url while refreshing the page using <code>ui-router</code> with <code>html5</code> mode enabled.</p>
<h3>Problem</h3>
<p>The problem occurs when I used an extend url, for example <code>/app/Welcome</code>. At first, I tought it was because of the nested state, since I was only using this type of url when I had a child state. But the problem also happened when I tried to access an url with parameters. These are the url I've tested so far:</p>
<p>url: 'Service/Tools'
url: '/Service/Tools'
url: '/Service/:myParam'
url: '/Service/Tools/:myParam'</p>
<p>For all of these url, when I refresh the page there is this error:</p>
<blockquote>
<p>Uncaught SyntaxError: Unexpected token &lt;</p>
<p>Uncaught ReferenceError: angular is not defined</p>
<p>Resource interpreted as Stylesheet but transferred with MIME type text/html:</p>
</blockquote>
<p>The only way I was able to refresh the page using <code>html5mode</code> enabled, was using a url like this: <code>url:'/Service'</code>.</p>
<p>It doesn't matter if it's a single state, nested state, abstract, etc.. If the url has more than 1 <code>/</code>, the error apear.</p>
<h3>Server</h3>
<p>I'm running this on an apache server with this rewrite rule:</p>
<pre><code>&lt;IfModule mod_rewrite.c&gt; 
    RewriteEngine On RewriteBase / 
    Options FollowSymLinks
    RewriteRule ^index\.html$ - [L] 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule . /index.html [L] 
&lt;/IfModule&gt;
</code></pre>
<p>Does anyone have any idea on how to solve this?</p>