How To Generate Lower Case URLs in .NET Core
How To .NET Core

How To Generate Lower Case URLs in .NET Core

Mishel Shaji
Mishel Shaji

Every .NET Web applications by default, generate URLs with the first letter of each word capitalized.

Mixing lowercase and uppercase letters might become an issue for SEO especially if you use both versions of the same URL.

Generate Lower Case URLs

The tag helpers will generate URLs with mixed casing. To turn this off and generate lowercase URLs, add the following line of code above services.AddControllersWithViews(); statement in the Startup.cs.

services.Configure<RouteOptions>(options => options.LowercaseUrls = true);
services.AddControllersWithViews();

From now on, all URLs will be generated in lowercase.

<a asp-action="About" asp-controller="Home">About</a>
URL containing only lowercase letters

Happy coding 👍.