Recommended status code for redirecting netlify subdomain to primary domain

Hi there,

A 200 is a rewrite or a proxy rule (cf Redirects and rewrites | Netlify Docs), which if used in that context does the opposite of what you want - it shows your site (mydomain.com) content at the netlify hostname (https://yoursite.netlify.com), instead of telling the browser “no, this is not the canonical URL, instead go over to https://mydomain.com” which is what a 301 redirect would do.

Those docs with the 200 example are buggy and have been live for a year and a half and you’re the first person to notice :scream_cat:! Thank you for calling it out; I’m fixing it now.

Doesn’t matter if it goes in _redirects or netlify.toml; both are parsed after deploy and applied to your site.

1 Like