title: 301 redirects after domain name change
body: <p>I run a small ASP.NET4 website on IIS.  I recently changed the domain name from 'olddomain.com' to 'newdomain.com'.  The change was made through Plesk.  After making the change I added 'olddomain.com' as a domain alias in plesk so that traffic would still route through to the website on the old domain.</p>
  
  <p>This is fine so far.  The website resolves on both old and new URLs.</p>
  
  <p>However, now I would like to set up 301 redirects everywhere so that any request for olddomain.com are forwarded to newdomain.com instead.  None of the website pages have changed - it's just a simple change of domain name.</p>
  
  <p>I've added this to the web.config file:</p>
  
  <pre><code>&lt;rewrite&gt;
      &lt;rules&gt;
          &lt;rule name="Redirect all to different domain" stopProcessing="true"&gt;
              &lt;match url=".*" /&gt;
              &lt;conditions&gt;
                  &lt;add input="{HTTP_HOST}" pattern="^olddomain.com$" /&gt;
              &lt;/conditions&gt;
              &lt;action type="Redirect" url="http://www.newdomain.com/{R:0}" redirectType="Permanent" /&gt;
          &lt;/rule&gt;
      &lt;/rules&gt;
  &lt;/rewrite&gt;  
  </code></pre>
  
  <p>But it doesn't seem to have any impact; when I load olddomain.com in the browser it just loads the website without redirecting to newdomain.com.</p>
  
  <p>Can anyone suggest what I've done wrong here and how to get the 301 to work?</p>
  
  <p>Thanks</p>