Copied to clipboard

Flag this post as spam?

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


  • Christopher W. Brandsdal 72 posts 133 karma points
    Aug 05, 2009 @ 10:46
    Christopher W. Brandsdal
    0

    Rewriting characters in URL

    Hi everyone!

    Have something that might be a problem with a simple solution. We have people writing all kinds of characters in the title field of pages. I actually typed a '#' character in the title field, and this ended in a 404. Is there a way to replace these kinds of characters with string.empty or something? Yes, I know there is workaround with umbracoUrlName but there should be some kind of automatic replacement..

    Here is an example title I created:
    Listing all files in a specified folder C# (foreach file in folder)

    Giving me this URL:
    /2009/8/4/listing-all-files-in-a-specified-folder-c#-(foreach-file-in-folder).aspx

    I would like it to just remove '#'.

    --------
    Christopher W. B.

  • cardinal252 21 posts 33 karma points
    Aug 05, 2009 @ 10:50
    cardinal252
    0

    you could create a module that checks the current url using a regex and redirect it in the case of junk characters. We have a similar module working on our site to 301 urls with %5 type characters.

  • Peter Dijksterhuis 1442 posts 1722 karma points
    Aug 05, 2009 @ 10:54
    Peter Dijksterhuis
    102

    That is allready possible. Check the umbracoSettings.config in the config-folder.

    There's a section there where you can define which characters you want to replace in the URL's. Just add your own to it.

    Remember to touch the web.config after you did. You also might need to republish all the pages for the changes to take effect.

    HTH,

    Peter

  • cardinal252 21 posts 33 karma points
    Aug 05, 2009 @ 10:57
    cardinal252
    0

    In our case we have far too many urls spidered in google from previous guises of the site so they would not be under umbraco control.

  • Christopher W. Brandsdal 72 posts 133 karma points
    Aug 05, 2009 @ 11:07
    Christopher W. Brandsdal
    0

    Great! I was hoping there was just a setting for this. A custom module was last chance, but was hoping I didn't need to go that long, lonesome road. ;-)

    Thanks guys!

  • Thomas Höhler 1237 posts 1709 karma points MVP
    Aug 05, 2009 @ 11:21
    Thomas Höhler
    0

    Christopher, if a post resolves your problem please mark this post as the solution.

    Thanks, Thomas

  • Christopher W. Brandsdal 72 posts 133 karma points
    Aug 05, 2009 @ 11:41
    Christopher W. Brandsdal
    0

    Thomas, Whell I have tried. It sayes solved, but does not save it. When I go into the post again it allows me to set posts as solved again.. Is there any button or link I need to click after checking te "mark this reply as the solution"?

  • Thomas Höhler 1237 posts 1709 karma points MVP
    Aug 05, 2009 @ 12:00
    Thomas Höhler
    0

    No I don't think so, this might be reported in the bugs section. But let us wait for the maintenance this noon and check again afterwards.

    Thomas

  • Daniel 44 posts 187 karma points
    Jan 29, 2014 @ 17:28
    Daniel
    0

    Just a heads up. The urlReplacing tag is removed in Umbraco 7. To achieve this make sure to add something like the following withing the <requstHandler> part.

        <urlReplacing>
          <char org="å">a</char>
          <char org="ä">a</char>
          <char org="ö">o</char>
          <char org="Ä">a</char>
          <char org="Ö">o</char>
          <char org="Å">a</char>
        </urlReplacing>

    http://our.umbraco.org/documentation/Using-Umbraco/Config-files/umbracoSettings/

Please Sign in or register to post replies

Write your reply to:

Draft