Copied to clipboard

Flag this post as spam?

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


  • Simon 2 posts 22 karma points
    Nov 13, 2014 @ 10:37
    Simon
    0

    Using Global.asax to create custom URLs

    I'm currently working on an Umbraco project where I (for SEO reasons) need to have custom URLs for each page.

    The customer must have the oppertunity to create 100% custom URLs.

    Ex. 1:

    "/accommodations/flats/london" could be changed to "/flats-in-london"

    Ex. 2:

    "/page/subpage/textpage/" could be changed to "/shop/page"


    I've tried my luck with Umbraco's "umbracoUrlName", but this is useless since it only changes the page name and not the path to the page aswell. I've also tried "umbracoUrlAlias", but this just gives the page an extra alias, which is bad for dublicate content. (I could use canonical, but this isn't a good solution)

    Anyone on Our who's got experience with this?

    Could I use MVC / Global.asax routes (MapRoute) to loop through all the pages and then add a MapRoute to all the nodes who has a "customUrl" alias? If this is possible, how is it done?

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    Nov 13, 2014 @ 10:53
    Dave Woestenborghs
    0

    Maybe you can create a custom UrlSegment Provider:

    http://our.umbraco.org/documentation/Reference/Request-Pipeline/outbound-pipeline

     

    Dave

  • Jeroen Breuer 4909 posts 12266 karma points MVP 5x admin c-trib
    Nov 13, 2014 @ 12:08
    Jeroen Breuer
    0

    With the UrlSegment you can only change a segment of the url. So /page/text2/ could become /page/text2-2014/ but you can't do /page/text2/2014 because than it's another segment. You need a UrlProvider and ContentFinder for that. I have an example in the Hybrid Framework:

    UrlProvider: https://github.com/jbreuer/Hybrid-Framework-for-Umbraco-v7-Best-Practises/blob/master/Umbraco.Extensions/UrlProvider/NewsUrlProvider.cs

    ContentFinder: https://github.com/jbreuer/Hybrid-Framework-for-Umbraco-v7-Best-Practises/blob/master/Umbraco.Extensions/ContentFinder/NewsContentFinder.cs

    Jeroen

  • 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