I have a MVC project with razor pages. I am moving some razor pages in static html pages but I do not like I see in url the index.html
extension.
I only wrote a 301 redirect rule:
<rule name="no-index-html">
<match url="^(.*)/index.html$" ignoreCase="false" />
<action type="Redirect" url="{R:1}" />
</rule>
It works... almost works... It makes 2 redirects:
The firstone is correct, the second one no..
The same happen if I write the url without the final slash.. A redirect 301 to the url with final slash happens:
So I cannot adopt the solution I have found in other posts on StackOverflow.. I mean something like this:
<rule name="TrailingSlash">
<match url="^(.*)/$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="false" />
</conditions>
<action type="Redirect" url="{R:0}" />
</rule>
If I add this, obviously It goes into a loop and I get the error too_many_redirects
...
I do not have nay other rule.. so What can I do? There is a standard rule on IIS that redirect to trailing slah when I point to directory? How can I remove it?