# How to return 301 Moved Permanently?

**URL:** <https://discourse.gohugo.io/t/how-to-return-301-moved-permanently/16734>\
**Category:** support\
**Created:** [January 30, 2019, 4:01pm UTC](https://discourse.gohugo.io/t/how-to-return-301-moved-permanently/16734 "2019-01-30T16:01:04Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sergei\_G](https://avatars.discourse-cdn.com/v4/letter/s/7feea3/32.png) [@Sergei\_G](https://discourse.gohugo.io/u/Sergei_G)\
**Post date:** [January 30, 2019, 4:01pm UTC](https://discourse.gohugo.io/t/how-to-return-301-moved-permanently/16734/1 "2019-01-30T16:01:04Z")

</div>

Hi guys,

I have reworked my wife’s website and re-imported data from another location. This will result in old product pages having 404 Not Found unless I manually redirect each page.

Is there a good way to do that in hugo that will work for Google indexing engine?

I don’t have access to the web server, because I host the static website on Google Storage bucket.

Am I totally out of luck in terms of implementing a proper 301 redirect?

---

<div class="post-metadata">

**Author:** ![moorereason](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/moorereason/32/592_2.png) [@moorereason](https://discourse.gohugo.io/u/moorereason)\
**Post date:** [January 30, 2019, 4:12pm UTC](https://discourse.gohugo.io/t/how-to-return-301-moved-permanently/16734/2 "2019-01-30T16:12:34Z")

</div>

You can use Hugo aliases to do page redirects, but to do this at the HTTP layer, you need a better host service (such as [Netlify](https://www.netlify.com/docs/redirects/)).

---

<div class="post-metadata">

**Author:** ![davidsneighbour](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/davidsneighbour/32/24507_2.png) [@davidsneighbour](https://discourse.gohugo.io/u/davidsneighbour)\
**Post date:** [January 30, 2019, 4:15pm UTC](https://discourse.gohugo.io/t/how-to-return-301-moved-permanently/16734/3 "2019-01-30T16:15:39Z")

</div>

I think you want to read about aliases:

> **[URL Management](https://gohugo.io/content-management/urls/)**
>
> Hugo supports permalinks, aliases, link canonicalization, and multiple options for handling relative vs absolute URLs.

Other than that, [Stackoverflow.com](http://Stackoverflow.com) has quite some answers about “Google Storage Buckets” and redirects. There seems to be a way via app.yaml - but this is out of the scope of Hugo.

---

<div class="post-metadata">

**Author:** ![maiki](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/maiki/32/16384_2.png) [@maiki](https://discourse.gohugo.io/u/maiki)\
**Post date:** [January 30, 2019, 6:43pm UTC](https://discourse.gohugo.io/t/how-to-return-301-moved-permanently/16734/4 "2019-01-30T18:43:08Z")

</div>

> [@Sergei\_G](#):
>
> Am I totally out of luck in terms of implementing a proper 301 redirect?

No, you are in luck. No go and setting it up easily in that storage service, but the good news is moving it elsewhere is super easy. There are tons of cheap and free hosting and has proper redirect systems. 🙂

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [January 30, 2019, 9:26pm UTC](https://discourse.gohugo.io/t/how-to-return-301-moved-permanently/16734/5 "2019-01-30T21:26:31Z")

</div>

We do that on the Hugo web sites with Netlify redirects: [https://github.com/gohugoio/hugoDocs](https://github.com/gohugoio/hugoDocs)

In short:

- Disable aliases
- Use the same alias definitions to create a Netlify redirects file with a Custom Output Format

---

<div class="post-metadata">

**Author:** ![Sergei\_G](https://avatars.discourse-cdn.com/v4/letter/s/7feea3/32.png) [@Sergei\_G](https://discourse.gohugo.io/u/Sergei_G)\
**Post date:** [January 31, 2019, 5:29am UTC](https://discourse.gohugo.io/t/how-to-return-301-moved-permanently/16734/6 "2019-01-31T05:29:02Z")

</div>

Thank you guys. It gives me enough pointers.

---

<div class="post-metadata">

**Author:** ![Jonathan\_Griffin](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jonathan_griffin/32/8355_2.png) [@Jonathan\_Griffin](https://discourse.gohugo.io/u/Jonathan_Griffin)\
**Post date:** [January 31, 2019, 7:07am UTC](https://discourse.gohugo.io/t/how-to-return-301-moved-permanently/16734/7 "2019-01-31T07:07:52Z")

</div>

I suggest you also see the following link if you go the aliases route:

> [@Aliases appear not to work properly in the New Google Search Console](https://discourse.gohugo.io/t/aliases-appear-not-to-work-properly-in-the-new-google-search-console/16246):
>
> I never saw an issue with the old version of the search console picking up the redirect, or most importantly the “canonical” as that is what they use to recognise a redirect. Basically, when I inspected the alias in the Search console (enter the url in the top bar to inspect it) it came back as no-index, and as such it did not display any other information about the url. I decided to test the meta refresh alias with a custom alias.html in the layouts directory removing the no-index: \<!DOCTYPE…
