Simple Ways to Redirect Old Domain to New Domain in IIS

You will undoubtedly address the migration issue while changing the domain name for your website. You cannot just disable DNS on your previous site since this would result in search engines removing your indexed content. When a person accesses an old URL, you should link them to the new URL in order to inform search engines that you now have a new domain name.

Take as an example; the previous domain was, and the current one is So basically for requests to the old, such as:

Then, we will redirect it to:

This just keeps the rest of the URL the same while changing the domain name.

To implement this feature, we need to install the URL Rewrite module on IIS:

For every website managed by IIS, it can assign URL rewrite or redirect rules individually. You can use both GUI and manually edit web.config to modify the rules.

My set up for changing the domain name would be:

                                <rule name="CanonicalHostNameRule">
                                        <match url="^(.*)$" />
                                                <add input="{HTTP_HOST}" pattern="^$" />
                                        <action type="Redirect" url="{R:1}" />

The pattern is using a regular expression, to check if {HTTP_HOST} is equal to

the {R:1} in the action means whatever is in the URL behind the domain name itself.

Redirect and Rewrite are the two options that we offer. Rewrite simply keeps the HTTP status code. For instance, if you have a “/a/b/c.html” and rewrite it into “/d.html,” Rewrite will simply make it appear as though you are accessing /d.html and its content is output using c.html. Redirect will result in an HTTP 301, which will notify the search engine about the domain change.

If you have any additional rules, pay attention to the sequence since they will be handled in that order.

You may refer to Microsoft documentation for more usage:

Now that we have a 301 redirect, the search engine’s index will also be updated. You can terminate DNS on your former domain after a few of months.


In previous post, we have written tutorial about how to redirect old URL to new URL using .NET. This article might be little bit different since you can access IIS to make change.

Are you looking for an affordable and reliable core hosting solution?

Get your ASP.NET hosting as low as $1.00/month with ASPHostPortal. Our fully featured hosting already includes

  • Easy setup
  • 24/7/365 technical support
  • Top level speed and security
  • Super cache server performance to increase your website speed
  • Top 9 data centers across the world that you can choose.

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *