Skip to content
StaticHero

Sites

_redirects and _headers files

Reference for redirect rules, rewrites and custom response headers.

Place _redirects and/or _headers at the root of your upload. They’re read on every deploy and never served publicly.

_redirects

# from            to                 status
/old              /new               301
/blog/*           /posts/:splat      302
/u/:user          /profile/:user     301
/app/*            /app/index.html    200
/legacy.html      /                  301!
  • Status codes: 200 (rewrite), 301, 302, 303, 307, 308, 404, 410.
  • ! forces the rule even if a file exists at the path.
  • Destination can be a path or a full https:// URL (for redirects, not rewrites).
  • Up to 1,000 rules; first match wins.

_headers

/assets/*
  Cache-Control: public, max-age=31536000, immutable
/*
  X-Frame-Options: DENY

Set-Cookie, Content-Length and other hop-by-hop headers can’t be set.

See the redirects guide for more examples.

Still stuck? Contact support.