0
votes

I have created some contents. I have noticed URL of content is generated automatically based on name of content. Can you please guide me if I can edit URL or enter a custom URL ?

Thanks

1

1 Answers

2
votes

You can do it in 2 ways:

1

Setup these rules in UrlRewrite.config in /config folder in your umbraco websites root. To add new rule:

<add name="produktidrewrite" 
    virtualUrl="^~/product/(.*).aspx" 
    rewriteUrlParameter="ExcludeFromClientQueryString" 
    destinationUrl="~/product.aspx?productid=$1" 
    ignoreCase="true" />

2.

Or you can add a custom route in your code. Create a new class which inherit from Umbraco.Core.ApplicationEventHandler. Then overwrite ApplicationStarted to add your rules. Like this:

protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
    //Custom route
    RouteTable.Routes.MapRoute(
    "SomeName",
    "Something/{action}/{id}",
    new
    {
        controller = "MyController",
        action = "Index",
        id = UrlParameter.Optional
    });
}