vue-router下的html5 history在iis服務器上的設置 vue去掉#


轉自:https://www.cnblogs.com/zzsdream/p/6576639.html

1.安裝 url rewrite模塊到IIS

下載地址

2.在web.config文件中 system.webServer 節點添加如下配置(如果沒有,自行添加一個Web.config)

  <system.webServer>
    <!--rewrite 節點,用於支持history模式-->
    <rewrite>
      <rules>
        <rule name="API Rule" stopProcessing="true">
          <match url="^(api|account|manage)(.*)$" />
          <action type="None" />
        </rule>
        <rule name="Angular Rule" 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>

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM