1

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

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

[http://localhost/销售]

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

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

这可能吗?

4

1 回答 1

1

实现这一目标的最佳方法是在 URL Rewrite Module中使用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>

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

我希望这会有所帮助。

于 2013-02-21T16:27:21.717 回答