Spring boot:配置tomcat服务器以使用HTML5模式

Spring boot:配置tomcat服务器以使用HTML5模式,spring,apache,.htaccess,spring-boot,Spring,Apache,.htaccess,Spring Boot,问题:如何在spring boot中配置.htaccess? angularjs提供HTML5模式,这使得你的应用程序使用基于pushstate的URL而不是hashtags。但是,这需要服务器端支持,因为生成的URL也需要正确呈现 如果您在apache服务器上运行angular应用程序,您可以轻松地将此规则添加到.htaccess文件中 # Apache .htaccess # angularjs pushstate (history) support: # See http://www.j

问题:如何在spring boot中配置.htaccess?

angularjs提供HTML5模式,这使得你的应用程序使用基于pushstate的URL而不是hashtags。但是,这需要服务器端支持,因为生成的URL也需要正确呈现

如果您在apache服务器上运行angular应用程序,您可以轻松地将此规则添加到.htaccess文件中

# 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>
#Apache.htaccess
#angularjs pushstate(历史)支持:
#看http://www.josscrowcroft.com/2012/code/htaccess-for-html5-history-pushstate-url-routing/
重新启动发动机
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写cond%{REQUEST_URI}!指数
重写条件%{REQUEST\u URI}!。*\。(css|js|html|png)#添加所需的额外扩展。
重写规则(.*)index.html[L]

请参见我的答案:这是否回答了您的问题?