品牌/运营/管理/IT综合咨询
IT/互联网+解决方案
业务及咨询:13919290690
售后支持:18693088690
info@radartek.com
support@radartek.com

Nginx rewrite规则指令:支持SPA/HTML5 Push state

睿达科网络提供:兰州网站建设/兰州网站制作/兰州网站设计/微信开发/SEO/代运营等服务…… 浏览更多产品服务

Nginx rewrite规则指令,将下面代码加入服务器nginx.conf配置文件即可,用于支持单页Web应用(single page web application,SPA)或HTML5 的 pushState。(Nginx rewrite for SPA/HTML5 Push state support。)

 location / {
        rewrite ^/.*/$ / last; # Redirect everything to / (ex index.html) and let the JS router take care of the rest
        rewrite ^([^.]*[^/])$ $1/ permanent; # Force trailing slash
    }