HUGO

How does Hugo aliases work?

I am wondering what is the mechanism of hugo aliases. Does it redirect page with 301 redirect or 302 redirect.

If a page has two or three aliases, will it effect SEO?

Thanks!

It redirects via meta http-refresh tag which can be compared to a 301 redirect.

I am personally not a fan of this method. Should you choose to host with Netlify you can make use of their _headers file where you can define more granular redirects that don’t need to load an html-page to redirect. You can add your own code there (301, 302) which is better in my opinion.

A page having multiple redirects/aliases will not affect SEO. Affecting SEO would be how the page in question is linked on other pages. They should link to the canonical URL, not one of the aliases.

You should see aliases mostly as ways to fix old URLs if you move pages or correct initial spelling errors or things like that.

@davidsneighbour Thank you for your reply. We are not hosting website on Netlify.

I understand the meta http-refresh tag will redirect user to another page. You say it can be compared to 301 redirect, so it is not exactly 301 redirect, am I right?

Please read https://gohugo.io/content-management/urls/#how-hugo-aliases-work and then ask about which part you don’t understand.

I totally understand the description on this part. What my question is the redirect is 301 or 302?

Googling gives plenty of results, including this one.

1 Like

301 and 302 are HTTP headers, meaning the server tells the browser to load another page instead of the one he asked for. Hugo’s redirection loads a page that then redirects you. That redirect is a 301 redirect, but for it to be applied a page needs to be loaded first.

Depending on your server you can define these HTTP redirects so that only the header 301 is sent without having to load a page first. But for that you need to google your server type and redirect as search terms. It’s most times quite easy.

2 Likes