Exploring the Routing Properties of Umbraco
When working on a website, it may be that you want to change the URL of a certain page within the CMS. Luckily, Umbraco offers a number of different routing options for this very task.
While we would usually use umbracoUrlAlias, we recently had umbracoUrlName brought to our attention as a potentially better option. Hopefully, this short blog will bring light and clarity to each property and how you can use them.
The best way to understand umbracoUrlAlias is to think of it as a URL shortener. With umbracoUrlAlias, you can create a comma separated list of alternative URL paths for the node. This means that the original URL will remain accessible, with the new URL alias simply acting as a ‘mask’ over the real URL in the browser address bar.
For example, if your URL was /category-name/page-name/content-node, you could create an umbracoUrlAlias of ‘flowers’ which would allow users to navigate to the node by going to /flowers. You could even specify paths like ‘flowers/roses/red’.
UmbracoUrlName effectively works as a URL replacement tool, as it allows you to change the default URL name created by the name of the node. If you enter a value for this property and save/publish the content node, the main URL will be updated with a new path suffix. Once complete, the original path will no longer exist, meaning the only way to access the node will be via the new URL.
For example, if your default URL was /category-name/page-name/content-node, you could use umbracoUrlName to update the value as ‘flowers’. The URL for this page would then be /flowers.
How to use them
Both umbracoUrlAlias and umbracoUrlName can be used on any document that’s accessible from the front end of your website.
All you need to do is add a text string to your document type and set the alias is either umbracoUrlAlias or umbracoUrlName.
Take a look at our example below for umbracoUrlName.
Remember, you can change the name from umbracoUrlName, as long as the alias next to the padlock remains umbracoUrlName!
Other routing options
If you don’t want to use umbracoUrlAlias or umbracoUrlName, there are two other routing options within Umbraco.
UmbracoRedirect performs a 302 redirect by using a Content Picker. Whereas, umbracoRedirectId does a complete URL rewrite.
For more information of UmbracoRedirect and UmbracoRedirectId, take a look at the official Umbraco Documentation.
If you’d like more information on Umbraco and the various built in routing properties, get in touch below. Our team of Umbraco experts are always on hand to help!