Tomcat 8 URL Rewrite Tomcat 8 URL Rewrite angularjs angularjs

Tomcat 8 URL Rewrite


I have found the solution, problem was in wrong/faulty rewrite.config file.Correct should be:

RewriteCond %{REQUEST_URI} ^/(css|img|js|partials|rest|favicon).*$RewriteRule ^.*$ - [L]RewriteRule ^.*$ /index.html [L,QSA]

On the first line are enumerated URIs which should not be rewritten. Everything else will be rewritten to index.html.


Is this deployed as a java web app (WAR)? You could implement this in your web.xml:

<servlet>   <servlet-name>index</servlet-name>   <jsp-file>/index.html</jsp-file></servlet><servlet-mapping>   <servlet-name>index</servlet-name>   <url-pattern>/</url-pattern>   <url-pattern>/about</url-pattern>   .. as many as you need ..<servlet-mapping>


I couldn't get this to work with the REQUEST_URI, and I didn't like having to whitelist specific files anyway, so I solved it in a slightly different manner.