Force lowercase on URLs - Kentico MVC

Gustavo Quevedo asked on October 31, 2019 19:22


Has anyone implemented a way to force lowercase of URLs on Kentico MVC and got it working?

I've tried setting this option in the CMS:

Settings / Content / URLs and SEO / SEO - URLs / Redirect invalid case URLs to their correct versions / Redirect all requests to lower case URLs

but it doesn't seem to do anything.

I've also tried this method:

The first part routes.LowercaseUrls = true; doesn't seem to change anything either.

Handling the Application_BeginRequest event seemed to bring other issues, or at least the way I implemented it.

Any help would be appreciated.

Kind regards,


Recent Answers

Roman Hutnyk answered on October 31, 2019 19:45

Have you considered configuring URL rewrite rule in web.config or IIS?

0 votesVote for this answer Mark as a Correct answer

Zach Perry answered on November 4, 2019 16:14

I reached out to support about this at one point. Forcing lowercase URLs via routes.LowercaseUrls will break page builder because those URLs are case sensitive. They told me you can try doing it that way and exclude urls that have cmsctx in the path. I gave up on the lowercase URLs before validating if this works.

0 votesVote for this answer Mark as a Correct answer

Ynze N answered on June 3, 2020 06:57 (last edited on June 3, 2020 07:15)

I can confirm that the page builder works when you exclude the /cmsctx path. This is the rewrite rule that I'm using:

    <rule name="LowerCaseRule1" stopProcessing="true">
      <match url="[A-Z]" ignoreCase="false" />
        <add input="{URL}" negate="true" pattern="^\/cmsctx\/?" />
      <action type="Redirect" url="{ToLower:{URL}}" />
0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.