TIP : Track your redirect & alias url's


Track redirect url’s

Very often you have to deal with redirect url, done on a server level. So it’s not immediate (or impossible) to get the stats about this.

I use www.netlify.com, and we can define a file _headers on the root, and they do the redirect for us.

So for example, If you had and old url that you redirect (301), you can do this:

https://www.mywebsite.com/index_en.html https://www.mywebsite.com/en?ref=old_url_index_en 301

Track alias url

I also use www.gohugo.io, and we can easily manage alias. So same principle here for your index.redir : add a ?ref=alias for example

# Netlify redirects from aliases
{{ range $p := site.Pages -}}
{{ range .Aliases }}
{{  . | printf "%-35s" }}   {{ $p.RelPermalink }}?ref=alias 301!
{{ end -}}
{{- end -}}

No more headache for finding redirect & alias stats. Thanks to plausible !

1 Like