• Published
  • 1 min

Lower case URLs in EPiServer

<p>EPiServer default generates all url's width the casing written by the author. This is not necessarily considered good practice according to SEO-standards. According to SEO best-practice, an url should be all lower case.</p>

This issue can be fixed with a few simple steps.
To get all your site urls to display in lower case do the following:

1. Add the following in your Global.asax.cs:

void UrlSegment_CreatedUrlSegment(object sender, EPiServer.Web.UrlSegmentEventArgs e)
        {
            e.PageData.URLSegment = e.PageData.URLSegment.ToLower();
        }

2. Add the following line in Application_Start

EPiServer.Web.UrlSegment.CreatedUrlSegment += new EventHandler<EPiServer.Web.UrlSegmentEventArgs>(UrlSegment_CreatedUrlSegment);

This pretty much fixes the issue, but to take care of all the URLs already created with CamelCase:

3. run the following sql on the database in question:

update tblPageLanguage set URLSegment = lower(URLSegment)

4 update previous versions (not really necessary, but if you want...):

update tblWorkPage set URLSegment = lower(URLSegment)

 

You now will get all URLs in lowercase. For the entire site.

PS! The observant visitor may notice that is not implemented on this site, - yet :-)