12

I have written an app to replace a single page and need to redirect the requests for the old page to the new app.

In IIS, how would I redirect the request for

http://www.mysite.com/foo.aspx

to

http://www.mysite.com/bar/default.aspx

Thanks!

James Evans
  • 187
  • 1
  • 1
  • 8

2 Answers2

9

In your web.config do:

<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>

If you don't want to write the redirects by hand, there is a tool for URL Rewrite and Redirects: http://www.iis.net/learn/extensions/url-rewrite-module/using-the-url-rewrite-module The installer says it is for 7.0 but it works with 8.5 as well.

mike
  • 2,149
  • 20
  • 29
-1

What you need is URL rewriting. There are a number of options. Some are discussed in this question:

IIS URL Rewriting vs URL Routing

Community
  • 1
  • 1
spoulson
  • 21,335
  • 15
  • 77
  • 102