title: How to Exclude Directories from Rules in Web.config (ASP.NET)
body: <p>I have these rules set in my Web.config:</p>
  
  <pre class="lang-xml prettyprint-override"><code>    &lt;rules&gt;
          &lt;rule name="replacedash"&gt;
            &lt;match url="(.*)(-)(.*)\.aspx$" /&gt;
            &lt;action type="Redirect" url="{R:1}{R:3}" redirectType="Permanent" /&gt;
          &lt;/rule&gt;
          &lt;rule name="extensionless" stopProcessing="true"&gt;
                &lt;match url="(.*)\.aspx$" /&gt;
                &lt;action type="Redirect" url="{R:1}" redirectType="Permanent" /&gt;
          &lt;/rule&gt;
          &lt;rule name="removeextension" enabled="true"&gt;
              &lt;match url=".*" negate="false" /&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;add input="{URL}" pattern="(.*)\.(.*)" negate="true" /&gt;
                  &lt;/conditions&gt;
                  &lt;action type="Rewrite" url="{R:0}" /&gt;
          &lt;/rule&gt;
      &lt;/rules&gt;
  </code></pre>
  
  <p>I've upgraded my website from plain ASP.NET to ASP.NET MVC and I've written these rules just in case there are still some old cached links in search engines with .aspx extensions; however, there are some directories on my web server that still contain .aspx files for good reasons and my rules are rewriting those extensions as well.</p>
  
  <p>How do I exclude these folders from inheriting my rules?</p>