TIL: Redirect and Rewrite Rules With Plain _redirects Files
A _redirects file maps old URLs to new ones. It is a plain text file with one rule per line.
/about /team 301
/blog/* /news/:splat 302
/old-page /new-page 301
Deploy the file to your site root. The platform reads it and applies the rules at the edge. No server config, no plugins, no build step.
/* https://other-site.com/:splat 302
A catch all redirect sends every path to another domain. Handy for domain migrations or when you merge sites.
Does _redirects support status codes?
The third column is the status code. 301 is permanent, 302 is temporary. Omitting it defaults to 200 (rewrite, not redirect).
Can I use _redirects with any static host?
Most Jamstack platforms support it. Netlify, Vercel, Cloudflare Pages all read a _redirects file. The syntax varies slightly between providers.