In this tutorial, you will learn how to create an Episerver initialisation module that will force all the URLs within your Episerver powered website to be lowercase. To improve your SEO ranking, you should ensure that your website can only be accessed using lowercase letters. Out-of-the-box, Episerver does not provide a way to enforce lowercase Url's. The module will hook into the Episerver
SavingPage event. This event is fired whenever a content editor tries to save a page. In the initialisation module, we will write some code that converts the slug to lowercase before the page is saved. This way you can guarantee all URLs will be lowercase. This is done using the Url Segment. The code for the module is shown below:
As you can see the module is pretty simple. On line 1, implement the correct attribute. On Line2, implement
IInitializableModule. Line13, uses
URLSegment and make it lowercase. You do not need to save the page here, the rendering pipeline will save the page for you. Also, make sure you also uninitialized it as well!
That is all you need to do to ensure lowercase URLs. You can find a code example here. Happy Coding 🤘