I am trying to remove the html extension from pages using web.config. Below is the code that I use in the web.config file.
<rewrite>
<rules>
<rule name="rewrite html">
<match url="(.*)$" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_FILENAME}" negate="true" pattern="(.*).html" />
</conditions>
<action type="Rewrite" url="{R:1}.html" />
</rule>
</rules>
</rewrite>
it works fine and removes the html extension, however, there seem to be 2 problems here:
When I put a 'slash', it does not work and does not cause errors. For example: http://example.com/my-page/now this will not work, but I put it http://example.com/my-page, then it will work fine, so I would like them both to work
, .html . , http://example.com/my-page.html, , , http://example.com/my-page, , 301 , , , 301 URL-.
, .