title: Why does IIS 7.5 adds a trailing slash on folders? Can we disable courtesy redirect for a URL Rewrite rule that removes trailing slash?
body: <p>IIS does URL cleanup on directories by adding a trailing slash. See this old docs from IIS 6:
  <a href="https://support.microsoft.com/en-us/help/298408/iis-generates-courtesy-redirect-when-folder-without-trailing-slash-is" rel="nofollow noreferrer">IIS generates courtesy redirect when folder without trailing slash is requested</a></p>
  <ol>
  <li>Why? Is the intent still relevant?</li>
  <li>Any security implications?</li>
  <li>How can I disable it to make this work with a URL Rewrite rule &quot;RemoveTrailingSlashRule&quot;</li>
  </ol>
  <p>When you add a rule under IIS 7.5 with URL Rewrite 2, the rule will not be applied to directories (using IsDirectory) and folders (using IsFolder).</p>
  <p>See this warning on Add a rule to append or remove the trailing slash symbol:
  <img src="https://i.stack.imgur.com/gMLfw.png" alt="See this warning on Add a rule to append or remove the trailing slash symbol" /></p>
  <p>This will create the RemoveTrailingSlashRule1:
  <img src="https://i.stack.imgur.com/1kPur.png" alt="Edit Inbound Rule RemoveTrailingSlashRule1" /></p>