Is `index.redir` still working for Netlify?

index.redir inside /layouts used to work but for my new site it seems to fails to generate the redirects.

Is it replaced by a plain _redirects in the /static root (with _headers) ?
Or is there some new option to activate it ?

I can’t find anymore any reference on the docs and nothing relevant in discourse. Is it me ?

Thanks for any tip/info.

You can have a _redirects file at the root of your published site, or put your redirects in your netlify.toml

1 Like

Yes thanks, I just changed for that.

But i can (almost :slight_smile: ) swear that there was a time where an index.redir generating this.

Anyway thanks for this (new ?) solution.

It’s not default, but if you look at the theme that powers there is one. We use Hugo aliases to generate the Netlify redirects file via a custom output format.


Ahhhhhhhhhhhhhhhhh . … yes thanks.
I totally forgot that I also added that part (sure it will not works without it :slight_smile:

For other people, i document here this config.toml part.
Again THANKS bep.

home = [ "HTML", "RSS", "REDIR" ]

suffixes = [""]
delimiter = ""

mediatype = "text/netlify"
baseName = "_redirects"
isPlainText = true
notAlternative = true

and index.redir

# Netlify redirects. See
{{  range $p := .Site.Pages -}}
{{ range .Aliases }}
{{  . | printf "%-35s" }}	{{ $p.RelPermalink -}}
{{ end -}}
{{- end -}}
1 Like

Some Update for sections and multi-language.

site.Pages only works for current language.

So you have to use {{ range $p := site.AllPages -}} to also get aliases for sections and all languages