Copied to clipboard

Flag this post as spam?

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

  • Sandra26 15 posts 115 karma points
    Oct 08, 2019 @ 13:35

    How to remove umbraco from url , creating custom routes


    I'm creating web api, using UmbracoApiController .

    I read and as a beginner I must admit I didn't find it very helpful.

    I'll really appreciate step by step instructions how to change the routes from /umbraco/api/controllerName/get?contentN=contentName to /api/v1/controllerName/contentName.

    Best , Sandra26

  • David Brendel 774 posts 2841 karma points c-trib
    Oct 08, 2019 @ 15:02
    David Brendel

    Hi Sandra,

    you can't change the routes from the default wired routes to use your custom ones.

    What you can do is adding redirect in IIS from your custom url to the default umbraco ones. Via web.config or directly in IIS if you have access.

    Or what you can try is to register your custom urls in the RouteTable like it is stated in the docs. For example like this:

                $"distinct route name",
                url, // url to match
                new { controller = controllerName, id = UrlParameter.Optional },
                new[] {controllerNamespace });

    Regards David

  • Sandra26 15 posts 115 karma points
    Oct 08, 2019 @ 15:12

    Hi David,

    I did that. I have problem how to implement FindContent(RequestContext requestContext, UmbracoContext umbracoContext)

     public class UmbracoVirtualNodeByNameRouteHandler : UmbracoVirtualNodeRouteHandler
            public UmbracoVirtualNodeByNameRouteHandler(string contentName) { }
            protected override IPublishedContent FindContent(RequestContext requestContext, UmbracoContext umbracoContext)


    Because I want go work with content name not with id like in the documentation. Best, Sandra26

Please Sign in or register to post replies

Write your reply to: