Change a Hugo Post URL Without Breaking the Old Link
Changing a published URL is easy. Preserving the links, bookmarks, and search history attached to the old one is the part that matters.
I avoid URL changes unless there is a clear reason, such as a typo or a site restructure. When a change is necessary, Hugo’s aliases front matter can keep the old path working.
Set the new URL
Change the post’s url value:
# Before (with typo)
url: /blog-post-wit-errors/
# After (corrected)
url: /blog-post-with-corrections/
2. Create an Alias for the Old URL
To preserve SEO value and prevent broken links, use the aliases parameter:
title: "Improving Blog Post URLs"
type: post
url: /blog-post-with-corrections/
aliases: ['/blog-post-wit-errors/']
Keep the original path as an alias
Add the complete old path to aliases:
Hugo generates a page at the alias path that points visitors to the new URL. That prevents an immediate 404, but there is an important detail: Hugo’s built-in alias page uses a client-side redirect, not a real HTTP 301 response.
If the hosting platform supports redirects, I prefer adding a permanent server-side redirect there as well. The exact configuration depends on Netlify, Cloudflare, Apache, Nginx, or whichever host serves the site.
Check more than the browser address bar
After building the site:
- Open the old URL and confirm that it reaches the new one.
- Confirm that the new page has its own canonical URL.
- Update internal links so they point directly to the new path.
- Check the production response if you configured a server-side
301. - Keep the old redirect indefinitely; external links may survive for years.
An alias is a useful fallback for a static Hugo build. For search engines, a real permanent redirect from the hosting layer is the stronger signal.