GitLab Pages redirects

@Grob Can you point me to documentation? I can’t find anywhere this [[redirects]] table. Should it be inside config.toml? I tried it, but it didn’t work.


Ah, I see - it’s Netlify specific. I was hoping for something general. :disappointed_relieved:

What web server do you use?

GitLab Pages. I expected something similar to Hugo Aliases.

GitLab docs say there is not config file to specify redirects, but you can use the HTTP meta refresh tag (this is actually how Hugo Aliases does it behind-the-scenes)

1 Like

I used Netlify redirects about a week ago on a project and it worked just fine.

I added a file _redirects to the root of the Hugo project.

Inside the file just write the redirects like so
/services.htm /services
/myob.htm /services/myob-bookkeeping/

I pushed to Netlify and tested the redirects and they worked.

Good to hear that Netlify redirects worked fine for you.

But, the original poster uses GitLab as web host, not Netlify. See above discussion.

You could get some inspiration from the Hugo docs:

In short:

  • We disable alias generation
  • Generate a “_redirects” file (Netlify specific) from a home page template based on the alias definitions

What are you talking about?

Read the entire post.