轉自: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>