Copied to clipboard

Flag this post as spam?

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


  • Andy 7 posts 26 karma points
    Feb 04, 2014 @ 17:30
    Andy
    0

    URL Re-writing remove trailing slashes without breaking /umbraco/

    Following an SEO review I have been asked to remove all trailing slashes from URLs on our site. I have tried the following rule but this breaks access to the backoffice:

     

    <add name="noendslash" 

                virtualUrl="^(.*)/$" 

                rewriteUrlParameter="IncludeQueryStringForRewrite" 

                redirect="Application"

                destinationUrl="~$1"

                ignoreCase="true" />

    Any regex experts who can help?

     

  • Mike Chambers 636 posts 1253 karma points c-trib
    Feb 04, 2014 @ 18:16
    Mike Chambers
    0

    there;s a setting in the web.config

    {add key="umbracoUseDirectoryUrls" value="true" /}

    which I presume you are already using if you don't have aspx extensions?

    and in combination with a setting in config/umbracosettings.config 

        {!-- this will add a trailing slash (/) to urls when in directory url mode --}
        {addTrailingSlash}false{/addTrailingSlash}

    this should accomplish what you want?

     

    forgot to mention updating the umbracosettings.config will require an apppool recycle to have that acted on, and you might have to republish the entire site to get url rebuilt for pages

  • Andy 7 posts 26 karma points
    Feb 04, 2014 @ 18:30
    Andy
    0

    Thanks I have all those settings correctly set. I think the issue is someone can still use /mypage/ and the end slash is not removed? 

  • Mike Chambers 636 posts 1253 karma points c-trib
    Feb 04, 2014 @ 18:34
    Mike Chambers
    0
  • Mike Chambers 636 posts 1253 karma points c-trib
    Feb 04, 2014 @ 18:36
  • Richard Soeteman 4049 posts 12922 karma points MVP 2x
    Feb 05, 2014 @ 07:07
    Richard Soeteman
    0

    Hi,

    Maybe a bit too much for your problem only but maybe SEO Checker can help http://soetemansoftware.nl/seo-checker This allows you to remove the / with a single mouse click and does all the other SEO rewrite rules for you and a lot more of course. Oh and it doesn't break the backoffice :).

    Maybe nice to install it on your dev machine to check what it can do.

    Best,

    Richard

  • Andy 7 posts 26 karma points
    Feb 05, 2014 @ 09:48
    Andy
    0

    Thanks I have been planning to start using SEO Checker with new sites. Will try to have a play and see how easiy we can integrate into this existing site - we already have lots of re-writes and the 404 Checker / Redirect package. 

  • Richard Soeteman 4049 posts 12922 karma points MVP 2x
    Feb 05, 2014 @ 09:55
    Richard Soeteman
    0

    Hi,

    Great it was already on your radar. It should work fine all together with rewrite rules and url tracker.


    Best,

    Richard

  • Andy 7 posts 26 karma points
    Feb 05, 2014 @ 10:35
    Andy
    0

    The IIS rewrite rule works on top the exsiting Umbraco rewrites. Also going to try trialing the SEO checker to add to the site for the content team.

    Huge thanks for your help :) 

Please Sign in or register to post replies

Write your reply to:

Draft