title: IIS 7.5 URL Rewrite rule to handle request based on user agent
body: <p>I have written a rule to redirect request based on user agent. The rule is set to redirect default requests (not mobile) to <code>Domain1</code> and requests from mobile devices to a mobile domain, <code>Domain2</code>.</p>
  <p>Even after applying the mobile redirect, all requests from mobile are taken to <code>Domain1</code>.</p>
  <p>See the redirect rule below. Can anyone tell me what I'm missing?</p>
  <pre class="lang-xml prettyprint-override"><code>&lt;rewrite&gt;
    &lt;rules&gt;
      &lt;rule name=&quot;Mobile UA redirect&quot; enabled=&quot;true&quot; stopProcessing=&quot;true&quot;&gt;
        &lt;match url=&quot;(.*)&quot; /&gt;
        &lt;conditions&gt;
          &lt;add input=&quot;{HTTP_USER_AGENT}&quot; pattern=&quot;^.*BlackBerry.*$ &quot; /&gt;
          &lt;add input=&quot;{HTTP_USER_AGENT}&quot; pattern=&quot;.*Mobile.*Safari&quot; /&gt;
        &lt;/conditions&gt;
        &lt;action type=&quot;Redirect&quot; url=&quot;Domain2&quot; /&gt;
      &lt;/rule&gt;
      &lt;rule name=&quot;Claritinchallenge to&quot; enabled=&quot;true&quot; stopProcessing=&quot;true&quot;&gt;
        &lt;match url=&quot;(.*)&quot; /&gt;
        &lt;action type=&quot;Redirect&quot; url=&quot;Domain1&quot; appendQueryString=&quot;false&quot; /&gt;
      &lt;/rule&gt;
    &lt;/rules&gt;
  &lt;/rewrite&gt;
  </code></pre>