Redirect to new domain after rebranding with IIS Url Rewrite Module

Client has a bunch of domains and and websites. Because They have decided to change company’s name recently I was asked to proceed with chanage of domain names as well. After few weeks of constantly informing visitors about planned changed We decided that it is a good time to abandon old domains and redirect visitors to new ones. In order to “be okay” with google (their page ranks, indexed pages and so on) we make those redirects permanent (301 Moved Permanently as a response status code). As all of the websites are hosted on IIS 7 I have decided to use URL Rewrite Module for the job. First of all - make sure You have Url rewrite module installed on Your server machine. Secondly, You need to update web.config file to something like the one that (assuming old-name):

                <clear />
                <rule name="rebranding" enabled="false" stopProcessing="true">
                    <match url="(.*)" />
                    <conditions logicalGrouping="MatchAll" trackAllCaptures="true">
                        <add input="{HTTP_HOST}" pattern="(.*)old-name(.*)" />
                    <action type="Redirect" url="http://{C:1}new-name{C:2}/{ToLower:{R:1}}" appendQueryString="true" />

You can do that in IIS manager as well. Some explanation here:

Have fun

comments powered by Disqus