Vue網站釋出到iis後提示404頁面不可訪問

星畔發表於2024-11-13
vue重定向和跨域配置:https://zhuanlan.zhihu.com/p/530688251
1.安裝元件:
URL Rewrite:https://www.iis.net/downloads/microsoft/url-rewrite
Application Request Routing:https://www.iis.net/downloads/microsoft/application-request-routing
2.新建一個web.config 放到釋出到資料夾根目錄
複製程式碼
<?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>
複製程式碼

或者在iis網站上面設定重寫規則:https://www.cnblogs.com/zhoushuang0426/p/11350297.html

相關文章