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

2017-11-23  本文已影响0人  可惜没如果_4d52

在发布的项目根目录添加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

上一篇 下一篇

猜你喜欢

热点阅读