美文网首页
react开发中react-route路径在iis服务器上刷新时

react开发中react-route路径在iis服务器上刷新时

作者: 可惜没如果_4d52 | 来源:发表于2017-11-23 15:43 被阅读0次

在发布的项目根目录添加web.config配置文件

    在配置文件中system.webServer节点中加入

        <rewrite>

            <rules>

                <rule name="Rewrite Text Requests">

                    <match url=".*">

                    <conditions>

                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />

                    </conditions>

                    <action type="Rewrite" url="index.html" />

                </rule>

            </rules>

           </rewrite>

如果依然报404 可能是因为rewrite节点无法被识别 安装URL Rewrite插件即可

下载地址   https://www.iis.net/downloads/microsoft/url-rewrite

相关文章

网友评论

      本文标题:react开发中react-route路径在iis服务器上刷新时

      本文链接:https://www.haomeiwen.com/subject/gpmzvxtx.html