Spring boot: configure your tomcat server to work with html5Mode

Question: how to configure .htaccess in spring boot?

angularjs provides html5Mode, which forces your application to use pushstate-based URLs instead of hashtags. However, this requires server-side support, as the generated URLs must also display correctly.

If you are using the angular application on an Apache server, you can easily add this rule to your .htaccess file.

# Apache .htaccess # angularjs pushstate (history) support: # See http://www.josscrowcroft.com/2012/code/htaccess-for-html5-history-pushstate-url-routing/ <ifModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !index RewriteCond %{REQUEST_URI} !.*\.(cssยฆjs|html|png) #Add extra extensions needed. RewriteRule (.*) index.html [L] </ifModule> 
+6
source share

Source: https://habr.com/ru/post/988707/


All Articles