[Solved] Posts lead to 404 (suspect baseURL problem)


The problem
Individual posts on my GitHub-hosted website no longer work while the post page itself loads correctly. Specifically:
website.com/post/ <-- lists all posts and loads correctly
website.com/post/cats/ <–GitHub 404, File not found

What changed
I upgraded from Hugo v0.17 to v0.25 and over-rode some template defaults. I tried reverting my code and using Hugo v0.17 again but wasn’t able to re-create the previous working version.

What I tried
I read through all the baseURL posts and tried toggling the below configurations without any difference:
baseURL = “http:||website.com|” or baseURL = “/” or baseURL = “” or no baseURL at all
canonifyURLs = true or canonifyURLs = false

I suspect this is a baseURL problem because the individual posts display correctly locally when using hugo server. I’m not sure how to proceed when GitHub gives a 404 on http:||website.com|post|cats| but I can see on GitHub that I pushed http:||github.com|username|mywebsite|tree|gh-pages|post|cat|index.html. Any thoughts or ideas on how I can troubleshoot further would be greatly appreciated. Thanks!


There is no way anyone can guess what your problem is without more information (what is “cats”?); i.e. a link to the site’s source would be good.


Are you saying you can’t read my mind? :wink:

The source is under master and gh-pages:

and the domain is here:

The problem is that this post works
while this leads to a 404

I think the breaking commit was the one on July 8 with comment spliced in lightbox from grid-side theme to create Origami gallery. Everything committed afterwards was an attempt to resolve the 404 problem.

Thank you for your help


This problem occurs because the Windows OS is case-sensitive. Change git to be case-sensitive and commit the resulting changes using:
git config core.ignorecase false
git mv -f OldFileNameCase newfilenamecase

More details
The source of the problem is upgrading from Hugo 0.17 to 0.25 on Windows. In 0.25, Hugo renames all the post.md files to lower-case, which is okay because it creates lower-case folders and updates the references to be lower-case. For example, \content\post\My-First-Post.md used to get converted to \public\post\My-First-Post\index.html in 0.17. In 0.25, that post gets converted to \public\post\my-first-post\index.html

See this git diff for a detailed compare of 0.17 vs 0.25

This is a problem on Windows because git was picking up the changed references (because those files were changing anyway) but not picking up the changed folder names. This led to situations where you were led to http://website.com/post/my-first-post/ and got a GitHub 404 because the file was actually still at \post\My-First-Post\index.html because git never picked up and I never committed the folder case change.

This was remedied by changing my git to be case-sensitive and committing the folder name changes. The two SO posts below were useful.

Git - folder case sensitive issue
git config core.ignorecase false

How do I commit case-sensitive only filename changes in Git?
git mv -f OldFileNameCase newfilenamecase