IIS 部属Vue

一、IIS安装url-rewrite

https://www.iis.net/downloads/microsoft/url-rewrite

二、vue-router配置
全局配置
 

const router = new VueRouter({
  mode: 'history',
  routes: [...]
})

二、Vue发布项目添加一个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>

 

上一篇:nginx proxy minio 默认页配置(三)


下一篇:nginx url匹配