title: How to ignore parent URL in asp.net redirects
body: <p>We have a website where by we need to redirect all the child urls of a site, but not the top level, i.e.</p>
  
  <p>www.domain.com/products/some-product-page redirects to www.domain.com/some-product-page</p>
  
  <p>That's all well and good. However, we have a page that exists on www.domain.com/products, and this page is being redirected to the site homepage.</p>
  
  <p>I've tried two methods to try and resolve this. The first, using negate to ignore the top level /products url. But this also causes the urls underneath that to be ignored.</p>
  
  <pre><code>&lt;rule name="Redirect Products child pages" stopProcessing="true"&gt;
            &lt;match url="^products/(.*)$" /&gt;
            &lt;conditions&gt;
              &lt;add input="{PATH_INFO}" pattern="^(/*)/?.*" /&gt;
              &lt;add input="{REQUEST_URI}" negate="true" pattern="^products" ignoreCase="true" /&gt;
            &lt;/conditions&gt;
            &lt;action type="Redirect" redirectType="Permanent"  url="{R:1}" /&gt;
          &lt;/rule&gt;
  </code></pre>
  
  <p>I've tried variations on that pattern input with little success.</p>
  
  <p>The second method I looked was creating a rule that looked just for the /products/ url, and stopped processing the rules, when found. But this also has the same effect as the first method.</p>
  
  <pre><code>&lt;rule name ="Prevent Products page redirect" stopProcessing="true"&gt;
            &lt;match url="(.*)" /&gt;
            &lt;conditions&gt;
              &lt;add input="{PATH_INFO}" pattern="^/products/" /&gt;
            &lt;/conditions&gt;
            &lt;action type="None" /&gt;
          &lt;/rule&gt;
  </code></pre>
  
  <p>So is there something I need to add, to the pattern, to make it ignore all the other URLs, or am I missing something else?</p>
  
  <p>Many thanks.</p>