title: Remove HTML extension with web config permanently
body: <p>I am trying to remove html extension from pages using web.config. Below is the code i am using in web.config  file</p>
  
  <pre><code>&lt;rewrite&gt;
    &lt;rules&gt;
      &lt;rule name="rewrite html"&gt;
        &lt;match url="(.*)$" /&gt;
        &lt;conditions logicalGrouping="MatchAll"&gt;
          &lt;add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /&gt;
          &lt;add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /&gt;
          &lt;add input="{REQUEST_FILENAME}" negate="true" pattern="(.*).html" /&gt;
        &lt;/conditions&gt;
        &lt;action type="Rewrite" url="{R:1}.html" /&gt;
      &lt;/rule&gt; 
    &lt;/rules&gt;
  &lt;/rewrite&gt;
  </code></pre>
  
  <p>it is working fine and removing html extension, however there seems to be 2 problems here :</p>
  
  <ol>
  <li><p>When i put 'slash' it does not work and gives me not found errors. For example: <code>http://example.com/my-page/</code> now it will not work, but I put <code>http://example.com/my-page</code> then it will work fine, so i would like to both of them to work</p></li>
  <li><p>Other problem is that <code>.html</code> pages are still opening. For example, if I open the page as <code>http://example.com/my-page.html</code> it is also working but I want it to convert to <code>http://example.com/my-page</code> automatically, I know I can use 301 redirects for this but that will not work as there are many of files here, so I have to use different 301 rules for different URLs.</p></li>
  </ol>
  
  <p>Please Advice.</p>
  
  <p>Thanks</p>