Seb*_*gua 4 iis-7 windows-server-2008 vue-router vuejs2
我需要配置IIS服务器和Vue 2应用程序的帮助,我刚刚vue 2 application在生产版本上安装了Windows IIS 7 server,并且一切正常,只有一件事不起作用:当我尝试打开任何用example mysite.com/somepagevue-router编写的带有链接“ ”的页面时,参见404 error,但是如果我单击菜单链接可以正常工作,如果您仅输入主网址mysite.com,它将打开,但其他任何路由均不起作用!
我想我需要设置我的httpRedirect或类似的东西!
根据您的信息,我假设您正在使用该history模式,这是我一直在使用的模式,您可以在此处进行参考:
<?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="index.html" />
</rule>
</rules>
</rewrite>
<httpErrors>
<remove statusCode="404" subStatusCode="-1" />
<remove statusCode="500" subStatusCode="-1" />
<error statusCode="404" path="/survey/notfound" responseMode="ExecuteURL" />
<error statusCode="500" path="/survey/error" responseMode="ExecuteURL" />
</httpErrors>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
Run Code Online (Sandbox Code Playgroud)
如vue-router文档中所述,要使用历史记录模式,您需要执行以下操作: