title: Rewrite url for Angular app within sub-folder
body: <p>I've got an Angular app using html5mode, but it's currently sitting within a sub-folder of a site: <a href="http://somesite.com/za/" rel="nofollow">http://somesite.com/za/</a></p>
  
  <p>So I've managed to rewrite the url to direct to my assets folder correctly, but I'm still getting 404s when I hit refresh or navigate directly to a page.</p>
  
  <hr>
  
  <p>So this works: <a href="http://somesite.com/za/assets/js/bundle.js" rel="nofollow">http://somesite.com/za/assets/js/bundle.js</a></p>
  
  <p>This doesn't work, 404: <a href="http://somesite.com/za/home" rel="nofollow">http://somesite.com/za/home</a></p>
  
  <hr>
  
  <p><strong>.htaccess</strong></p>
  
  <pre><code>RewriteEngine On
  #This apparently creates a redirect loop for angular
  RewriteRule ^(.*)/$ /$1 [L,R=301] 
  
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^(za/.*) /za/index.html [NC]
  
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^(?:[^/]*/)*([^/.]+\.(?:jpe?g|gif|bmp|png||css|js))$ za/assets/$1 [R=301,L,NC]
  
  AddType image/svg+xml svg svgz
  AddEncoding gzip svgz
  </code></pre>
  
  <p>So where is the rewrite failing to redirect to index.html when I hit or refresh a page? </p>