zoukankan      html  css  js  c++  java
  • 应用发布到IIS后刷新页面返回404的解决方案

    这种情况需要配置IIS URL Rewrite,新增web.config文件,并填充以下内容,粘贴到wwwroot目录下。

    Vue项目

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
    <system.webServer>
    <rewrite>
    <rules>
    <rule name="Handle History Mode and custom 404/500" stopProcessing="true">
    <match url="(.*)" />
    <conditions logicalGrouping="MatchAll">
    <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
    </conditions>
    <action type="Rewrite" url="/" />
    </rule>
    </rules>
    </rewrite>
    </system.webServer>
    </configuration>

    React项目

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
    <system.webServer>
    <rewrite>
    <rules>
    <rule name="ReactRouter" patternSyntax="ECMAScript" stopProcessing="true">
    <match url=".*" />
    <conditions>
    <add input="{HTTP_METHOD}" pattern="^GET$" />
    <add input="{HTTP_ACCEPT}" pattern="^text/html" />
    <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
    </conditions>
    <action type="Rewrite" url="/index.html" />
    </rule>
    </rules>
    </rewrite>
    </system.webServer>
    </configuration>
  • 相关阅读:
    java中awt和swing是的关系以及区别
    java 5.0和java6.0的区别
    bpel 经典实例入门教程
    java中指针的问题
    linux下软件的基本安装和卸载
    stomp与veil用法
    in perspective用法
    不錯的句子
    fit into用法
    ceremony用法
  • 原文地址:https://www.cnblogs.com/ycm-up/p/12572309.html
Copyright © 2011-2022 走看看