Copied to clipboard

Flag this post as spam?

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


  • Morten Christensen 596 posts 2770 karma points admin hq c-trib
    Feb 19, 2010 @ 16:56
    Morten Christensen
    0

    Maintain letter casing/spacing in url

    Hi All,

    Not really sure where this posts bets fits, but here goes.

    I just wondering if there is an "easy" to allow both upper and lower case letters, as well as spaces in URLs? By default umbraco creates a URL with lowercase letters and spaces has been replaced by a -

    i.e.: /about/home/runway-page.aspx

    what i'm looking to do is something like i.e.: /About/Home/Runway Page.aspx

    Is this possible to do via urlrewrite.config (haven't been able to find anything in the documentation) or is my only option messing around with IIS?

    - Morten

  • Kim Andersen 1447 posts 2196 karma points MVP
    Feb 19, 2010 @ 20:39
    Kim Andersen
    1

    Hi Morten

    I'm not sure how to achieve this, but seen from a user/SEO point of view, its better to have a hyphen (-) than a space in the url. Because some browsers stil can't understand a space in the URL, and makes %20 instead. This can easily give some very ugly URL's. And Google sees a hyphen as a space, so this would work just fine. Why do you want to change this? - just currious :)

    This was just a small tip, and not the answer to your question at all.

    No matter what, I'll follow this question, because it's already nice to know :)

    /Kim A

  • Douglas Robar 3570 posts 4671 karma points MVP ∞ admin c-trib
    Feb 20, 2010 @ 09:30
    Douglas Robar
    1

    I agree with Kim that you probably don't want to use spaces in urls. They'll work but when you paste one into and email, for instance, the auto-linking in most email systems (and forum packages) will stop at the first whitespace, which wouldn't be the full url.

    But if you do want to do it, or simply to modify the rules that umbraco uses to create urls, look in the /config/umbracoSettings.config file. You'll see a section that has all the rules for the urls. You can add or remove any you like. They are applied top to bottom.

    cheers,
    doug.

  • Morten Christensen 596 posts 2770 karma points admin hq c-trib
    Feb 21, 2010 @ 10:57
    Morten Christensen
    0

    I agree with both of you, and I actually like the fact that Umbraco is setup by default to replace a space with a hyphen. So I gave you both the thumbs up.
    But the space replacement was actaully just a little extra thing I put in there because I was wondering if it was even possible. Which is was, simply editing the umbracoSettings.config was an easy task.

    But the question about upper/lower case urls still hasn't been answered. No where in the umbraoSettings.config does it mention letter casing, and it seems that default is making everything lowercase.
    What I was hoping for was that I could tell Umbraco to leave casing of the letters to the end user, and still be able to use umbraco.library.NiceUrl to get the url with the right casing.

    The reason why i'm asking about the upper/lowecase letters is that we had one customer wanting to be in control of upper/lowercase letters in the url because of product branding concerns - some products should always be written in uppercase letters, and at the moment I don't see that this is possible in Umbraco without some kind of hack? Maybe i'm wrong?

    Anyway thanks for answering

    - Morten

  • Morten Bock 1867 posts 2140 karma points MVP 2x admin c-trib
    Feb 21, 2010 @ 12:09
    Morten Bock
    0

    Umbraco does an explicit ToLower when creating the xml for a document:

    x.Attributes.Append(addAttribute(xd, "urlName", url.FormatUrl(urlName.ToLower())));

    So I would guess that the best bet is do make some sort of module of your own that makes sure that visitors that arrive at example.com/home/this_should_be_capital/details.aspx are 301 redirected to example.com/home/THIS_SHOULD_BE_CAPITAL/details.aspx

    I think you might be able to pull that off using urlrewriting.config but you need to make sure that you make it case sensitive somehow first.

  • Morten Bock 1867 posts 2140 karma points MVP 2x admin c-trib
    Feb 21, 2010 @ 12:23
    Morten Bock
    2

    This might be a starting point:

        <add name="caserewrite"
              virtualUrl="^~/(.*)productname(.*)"
              rewriteUrlParameter="ExcludeFromClientQueryString"
              destinationUrl="~/$1PRODUCTNAME$2"
              redirectMode="Permanent"
              ignoreCase="false" />

     

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies