【问题标题】:URL Rewrite IIS - Map From One Path To AnotherURL 重写 IIS - 从一个路径映射到另一个路径
【发布时间】:2013-02-22 00:27:21
【问题描述】:

我正在使用 IIS 7 中的 URL 重写

我想要的行为是当有人输入时

[http://localhost/Sales]

他们被重定向到 [http://localhost/SalesDemo]

但他们仍然在浏览器 URL 中看到 [http://localhost/Sales]

这可能吗?

【问题讨论】:

    标签: iis iis-7 url-rewriting


    【解决方案1】:

    实现这一目标的最佳方法是在 URL 重写模块中使用 Rewrite Maps

    或者,您可以将rewrite 部分添加到您的web.config 文件中。

    Web.config 示例:

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
        <system.webServer>
            <rewrite>
                <rules>
                    <rule name="Rewrite rule">
                        <match url="^Sales$" />
                        <action type="Rewrite" url="SalesDemo" />
                    </rule>
                </rules>
            </rewrite>
    
        </system.webServer>
    </configuration>
    

    如果您仍想在浏览器中看到/Sales,请注意操作类型必须是Rewrite(而不是Redirect)。

    我希望这会有所帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-06-11
      • 2022-11-03
      • 1970-01-01
      • 2018-09-06
      • 2014-11-02
      相关资源
      最近更新 更多