Skip to main content

Use IIS URL Rewrite Module rule to remove trailing slashes from URLs.

<!-- ... -->
<system.webServer>
  <rewrite>
    <rules>
      <!-- To always remove trailing slash from the URL -->
      <rule name="Remove trailing slash" stopProcessing="true">
        <match url="(.*)/$" />
        <conditions>
          <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
          <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
        </conditions>
        <action type="Redirect" redirectType="Permanent" url="{R:1}" />
      </rule>
    </rules>
  </rewrite>
</system.webServer>
<!-- ... -->