A very common SEO requirement is to ensure that each page on your website has a unique URL. Google will treat www.website.com/page1 and www.website.com/page1/ as different URLs. In this tutorial, you will learn how to configure Episerver so that all the generated URLs on your website will either always include or excludes a trailing slash to give your site that extra SEO mojo!

Like everything in Episerver, you can use an API to configure Episerver. Configuring Episerver to either include or, remove a trailing slash can be done via the RoutingOptionsAPI. To get access to the RoutingOptionsAPI you can inject it using the ServiceLocator, however, I recommend you use dependency injection and constructor injection instead.

When you get access to the API, you can use the UseTrailingSlash property. For reference, you can also do the same thing yourself in code. To learn more about that you can check out this article. As an added bonus, in this tutorial I will also show you how to configure Episerver to render all links as lowercase.

How To Make All The URL's Lowercase

To make all of the generated URLs render in lowercase, you can use this API:

The best place to add this configuration code is either within your global.asax, or, an Episerver initialization module. Now you know about these two handy APIs and how to use them, you should be able to get your webpages ranked slightly higher in Google. Happy Coding 🤘