blazor发布之后 刷新404的解决方法

其实所有单页面应用都一样

只需要在nginx里面配置

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

或者

        location / {
          try_files $uri $uri/ /index.html;
        }

部署到gitee上需要加一个.spa文件 详见Pages 单页面应用支持

posted @ 2021-01-11 20:03  咬轮猫  阅读(401)  评论(0编辑  收藏  举报
Live2D