IIS:如何将一个页面的请求重定向到另一个页面?

Jam*_*ans 8 iis redirect request

我编写了一个应用程序来替换单个页面,需要将旧页面的请求重定向到新的应用程序.

在IIS中,我将如何重定向请求

http://www.mysite.com/foo.aspx
Run Code Online (Sandbox Code Playgroud)

http://www.mysite.com/bar/default.aspx
Run Code Online (Sandbox Code Playgroud)

谢谢!

mik*_*ike 7

在你的web.config中执行:

<configuration>
<system.webServer>
    <rewrite>
        <rules>
            <rule name="Foo_To_Bar" stopProcessing="true">
                <match url="^foo.aspx" />
                <action type="Redirect" url="/bar/default.aspx" redirectType="Temporary" />
            </rule>
        </rules>
    </rewrite>
</system.webServer>
Run Code Online (Sandbox Code Playgroud)

如果您不想手动编写重定向,则可以使用URL重写和重定向工具:http://www.iis.net/learn/extensions/url-rewrite-module/using-the-url-rewrite -module安装程序说它适用于7.0,但它也适用于8.5.


spo*_*son -1

你需要的是 URL 重写。有多种选择。这个问题讨论了一些:

IIS URL 重写与 URL 路由