By default Umbraco 8 will add a trailing slash to your URLs.

It is really easy to disable this behaviour and remove the trailing slash from the URLs.

Simply edit your umbracoSettings.config file which can be found in the config folder, then add the following line before the </requestHandler> tag.


This will tell Umbraco to stop adding the trailing slash to all your URLs, if the changes are not reflected straight away, be sure you recycle your Application Pool.

There are more options available for the requestHandler, you can find the full list here in the Umbraco Documentation.
Thanks to Warren on Twitter who reminded me of this page šŸ‘.

If you make this change on an active website with pre-existing content, then you will want to add a rewrite rule to take your users (and search bots) to the new URL with a 301 redirect.

To do this simply add the following rewrite to your Web.Config after the <rules> tag:

<ruleĀ name="RedirectTrailingSlash"Ā stopProcessing="true">
<match url="(.*?)/+$" />
  <add input="{REQUEST_METHOD}" pattern="^POST$" negate="true" />
    <add input="{REQUEST_METHOD}" pattern="^PUT$" negate="true" />
    <add input="{REQUEST_METHOD}" pattern="^DELETE$" negate="true" />
    <add input="{REQUEST_METHOD}" pattern="^PATCH$" negate="true" />
    <add input="{REQUEST_URI}" pattern="^/umbraco/" negate="true" />
    <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
  <action type="Redirect" redirectType="Permanent" url="{R:1}" />

Thanks to Ronald on Slack for providing an updated rewrite rule, this one skips POST, PUT, DELETE, PATCH as this would remove the body data, and excludes the Umbraco folder so that the previews continue to work correctly.


Post a comment

Fields marked with an * (asterisk) are required

Recent Posts

How to pass a Content Security Nonce (CSP) to G...

How to use a CSP nonce with...

UmbCheckout 1.0.0 & UmbCheckout.StarterKit.Stri...

The stable version of UmbCh...

Voting is now open for the Green Business of th...

We've been shortlisted! - P...

We have been shortlisted in The Petersfield Awa...

We have been shortlisted fo...

Please nominate us in The Petersfield Awards!

If you believe in what we d...

Browse Umbraco Hosting

Umbraco Hosting Starting At $26/month