Vue網站發佈到iis後提示404頁面不可訪問

參考:https://www.cnblogs.com/yhnet/p/14804869.html
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>

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章