问题原因:

React Router是客户端的路由,当再次刷新时,IIS无法定位,因此抛出404错误。

 

解决方法:

配置站点下的web.config文件。

<rewrite>
<rules>
<rule name="Rewrite Text Requests" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_METHOD}" pattern="^GET$" />
<add input="{HTTP_ACCEPT}" pattern="^text/html" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
</conditions>
<action type="Rewrite" url="/WechatApp/index.html" />
</rule>
</rules>
</rewrite>

配置web.config的前提,需要服务器安装了重定向组件,组件的下载位置:

re_write_x86_zh_CN.msi from microsoft

re_write_x64_zh_CN.msi from microsoft

相关文章:

  • 2021-10-03
  • 2022-12-23
  • 2022-01-05
  • 2022-12-23
  • 2022-02-20
  • 2022-12-23
  • 2022-12-23
  • 2021-07-17
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-19
  • 2021-06-04
  • 2021-07-28
  • 2021-06-20
相关资源
相似解决方案