Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Tom 34 posts 154 karma points
    Oct 03, 2017 @ 09:23
    Tom
    0

    Trailing slash and resources

    Hi, In my umbracoSettings.config file there's a setting called addTrailingSlash which is set to 'true'. I'm aware this is not only a thing of aesthetics but also of semantics ( ''/'' indicates a folder, if omitted it indicates a file).

    To make the whole thing complete SEO wise I wanted to create a rewrite rule so that URL's without a trailing slash would be redirected to a variant which does contain a trailing slash. I've added the following snippet to the UrlRewriting.config file.

    <add name="301Redirect_AddTrailingSlash"
               redirectMode="Permanent"
               redirect="Application"
               ignoreCase="true"
               rewriteUrlParameter="IncludeQueryStringForRewrite"
               virtualUrl="(.*[^/])$"
               destinationUrl="$1/" />
    

    This creates another problem though since resources such as .js, .css files etc. obviously cannot be reached if a slash is added to the end of the path.

    Is there a way to fix this? Either by adding a property which tell's the urlrewrite config to ignore files or is there perhaps another solution?

    I'm aware there's a rewrite module available for IIS which could help to fix this but I prefer to stay with the thing that come out-of-the-box with a default Umbraco installation.

    Thanks!

Please Sign in or register to post replies

Write your reply to:

Draft