# Why Convert the URL/Path to Lowercase?

**URL:** <https://discourse.gohugo.io/t/why-convert-the-url-path-to-lowercase/50736>\
**Category:** support\
**Created:** [July 16, 2024, 9:40pm UTC](https://discourse.gohugo.io/t/why-convert-the-url-path-to-lowercase/50736 "2024-07-16T21:40:53Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![npadgett](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/npadgett/32/22389_2.png) [@npadgett](https://discourse.gohugo.io/u/npadgett)\
**Post date:** [July 16, 2024, 9:40pm UTC](https://discourse.gohugo.io/t/why-convert-the-url-path-to-lowercase/50736/1 "2024-07-16T21:40:53Z")

</div>

Why is the default behavior of Hugo to [convert the url/path to lowercase](https://gohugo.io/getting-started/configuration/#disablepathtolower)? I was converting ~2,500 static pages to Hugo and didn’t realize this was the default behavior until I stumbled across lowercase URLs in my sitemap.xml. This is unintuitive.

---

<div class="post-metadata">

**Author:** ![icedogas](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/icedogas/32/22338_2.png) [@icedogas](https://discourse.gohugo.io/u/icedogas)\
**Post date:** [July 18, 2024, 4:32pm UTC](https://discourse.gohugo.io/t/why-convert-the-url-path-to-lowercase/50736/2 "2024-07-18T16:32:29Z")

</div>

As an SEO optimizer, I will say that the ability to use uppercase and lowercase letters in URLS opens a Pandora’s box of issues with indexing, duplication, and subsequent patching up, 301 redirects, and other unnecessary tasks and problems. It’s very good that they thought about us and made it so that we don’t have to worry about it 😅

---

<div class="post-metadata">

**Author:** ![npadgett](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/npadgett/32/22389_2.png) [@npadgett](https://discourse.gohugo.io/u/npadgett)\
**Post date:** [July 18, 2024, 7:38pm UTC](https://discourse.gohugo.io/t/why-convert-the-url-path-to-lowercase/50736/3 "2024-07-18T19:38:58Z")

</div>

The trouble is this default behavior is not clearly documented, it is not intuitive, and it is not consistent.

For example, I migrated a page with the path `/states/AZ.md`. ~~Hugo generated `/states/AZ/index.html` and~~ Hugo server served `/states/AZ/`. However, `/sitemap.xml` linked to `/states/az/`. If I had pushed this code to Production (AWS S3), my sitemap would have contained 51 broken links.

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [July 18, 2024, 9:39pm UTC](https://discourse.gohugo.io/t/why-convert-the-url-path-to-lowercase/50736/4 "2024-07-18T21:39:42Z")

</div>

> [@npadgett](#):
>
> However, `/sitemap.xml` linked to `/states/az.html`

I am unable to reproduce this. Try it:

```plaintext
git clone --single-branch -b hugo-forum-topic-50736 https://github.com/jmooring/hugo-testing hugo-forum-topic-50736
cd hugo-forum-topic-50736
hugo server

```

---

<div class="post-metadata">

**Author:** ![npadgett](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/npadgett/32/22389_2.png) [@npadgett](https://discourse.gohugo.io/u/npadgett)\
**Post date:** [July 18, 2024, 11:10pm UTC](https://discourse.gohugo.io/t/why-convert-the-url-path-to-lowercase/50736/5 "2024-07-18T23:10:03Z")

</div>

Into the rabbit hole …

Thanks for the example, @jmooring.

I updated `hugo.toml` and reverted `disablePathToLower` to its default value (`false`).

I created a custom link to the page [Arizona](https://discourse.gohugo.io/states/AZ), which renders as `<a href="/states/AZ">Arizona</a>`. If I click the link, Hugo server serves `http://localhost:1313/states/AZ/` (without redirect or error).

1. Since Hugo server served `/states/AZ/`, I incorrectly assumed that Hugo generated the file `/public/states/AZ.html`. However, I only see `/public/states/az.html` in the file system.

2. I’m on a Mac. I assumed URLs were case sensitive.

3. On my project, I saw a separate issue that contributed to my confusion.

```auto
ERROR open /redacted/public/states/ak/index.htm: not a directory
ERROR open /redacted/public/states/ca/index.htm: not a directory
ERROR open /redacted/public/states/al/index.htm: not a directory
ERROR open /redacted/public/states/cn/index.htm: not a directory
ERROR render: failed to render pages: open /redacted/public/states/az/index.htm: not a directory

```

This leads me to … why does Hugo serve case-insensitive paths? My custom links would have failed when I went to Production.

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [July 18, 2024, 11:52pm UTC](https://discourse.gohugo.io/t/why-convert-the-url-path-to-lowercase/50736/6 "2024-07-18T23:52:25Z")

</div>

I am not able to reproduce what you describe. I’ve updated the example to include case-sensitivity test links on the home page:

```plaintext
git clone --single-branch -b hugo-forum-topic-50736 https://github.com/jmooring/hugo-testing hugo-forum-topic-50736
cd hugo-forum-topic-50736
hugo server

```

Maybe you didn’t clear the public directory when you were changing file names or whatever.
