title: URL Rewrite from one Host to another
body: <p>I am trying to rewrite all URL from a host, host1 (<code>www.host1.com</code>) to a new new host, host2 (<code>www.host2.com</code>). I want all the folders and subfolders of host1 to redirect to the main page of host2. That means www.host1.com/test.php should redirect to www.host1.com</p>
  
  <pre><code> &lt;rule name="Test Redirect" enabled="true" stopProcessing="true"&gt;
                  &lt;match url="(.*)" /&gt;
                  &lt;conditions logicalGrouping="MatchAll"&gt;
                      &lt;add input="{HTTP_HOST}" pattern="^(?:www\.)?host1.com" /&gt;
                  &lt;/conditions&gt;
                  &lt;action type="Redirect" url="http://www.host2.com/{R:0}" appendQueryString="false" redirectType="Found" /&gt;
              &lt;/rule&gt;
  </code></pre>
  
  <p>It seems my pattern is incorrect because it does not redirect when the url is www.host1.com/test.php but does when it is just www.host1.com. How can I fix this?</p>