Change a URL on a Post (While Preserving SEO)

If you use Hugo, we’ve all been there: create a post, give it a url - spell something wrong in the url, doh! This post hopes to explain how you can change the URL of a post, while preserving the SEO benefits associated with it.

We can do this, by changing the URL on the post to what we want then setting up an alias for the old url. This was existing traffic and Google still know what’s going on and will treat it as the same page.

1. Change Post URL

from incorrect url: url: /how-to-chaneg-url-on-post/

to fixed url: url: /how-to-change-url-on-post/

2. Create an Alias

1
2
3
4
title: "How to Change a URL"
type: post
url: /how-to-change-url-on-post/
aliases: ['/how-to-chaneg-url-on-post/']

In the example above, we used the ‘aliases’ section to create a dummy page for us. This page just contains a redirect link to our new page using a meta tag.