title: How to exclude a directory with IIS URL rewriting?
body: <p>I have a domain.com/index.php and a friendly url rule to redirect domain.com/index.php?s=? requests. I use IIS webserver with the URL rewrite add-on.</p>
  
  <p>Above works fine. However, there is a problem with requests to the admin directory...</p>
  
  <p>I also have domain.com/admin/cloud/index.php, which is sometimes needed to obtain or send data (via Ajax). When the rule is active the data is not available, when I delete the above rule then the data is available.</p>
  
  <p>How can I use above url rule and exclude all other requests inside (or to) domain.com/admin/.. ?</p>
  
  <p>This is my current rule-set:</p>
  
  <pre><code>&lt;rule name="RedirectUserFriendlyURL1" stopProcessing="true"&gt;
      &lt;match url="^index\.php$" /&gt;
      &lt;conditions&gt;
          &lt;add input="{REQUEST_METHOD}" pattern="^POST$" negate="true" /&gt;
          &lt;add input="{QUERY_STRING}" pattern="^s=([^=&amp;amp;]+)$" /&gt;
      &lt;/conditions&gt;
      &lt;action type="Redirect" url="{C:1}" appendQueryString="false" /&gt;
  &lt;/rule&gt;
  &lt;rule name="RewriteUserFriendlyURL1" stopProcessing="true"&gt;
      &lt;match url="^([^/]+)/?$" /&gt;
      &lt;conditions&gt;
          &lt;add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /&gt;
          &lt;add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /&gt;
      &lt;/conditions&gt;
      &lt;action type="Rewrite" url="index.php?s={R:1}" /&gt;
  &lt;/rule&gt;
  </code></pre>
  
  <p>I tried many ways, including path info... but without success. Maybe someone can give a hint?</p>
  
  <p>Thanks!</p>