Redirect old addresses with a _redirects file in your site
Ship a _redirects file with your site and matching requests get a 301 or 302, in the format Netlify and Cloudflare Pages use, so a site moving here can bring its redirects along. Works for Level 0 sites.
Put a file named _redirects at the root of your site’s build and the edge redirects matching requests before it looks for a page. Each line is a source path, a destination and an optional status:
/computer /host-a-node/ 301
/post/* https://blog.example.com/post/:splat/ 301
/:year/:month/:slug /:slug 301
It’s the format Netlify and Cloudflare Pages use, so a site moving from either can bring the file it already has. The status defaults to 301, and only 301 and 302 are accepted.
How rules are matched. Exact paths are checked first, then wildcard rules in file order, and the first match wins. A * at the end of a source captures the rest of the path as :splat, and a segment like :slug captures one part. The visitor’s query string is carried over to the destination. Destinations can be paths on your own site or full URLs on another.
Trailing slashes, on request. Add the comment line # ee:trailing-slash on and any page address without a trailing slash, such as /about, redirects to /about/. It runs after your own rules, so it never adds a step in front of a redirect you wrote. This is how our own website keeps every address from its old host working.
Removing a rule takes effect quickly. Redirect responses are cached for five minutes, not indefinitely, so a rule you take out stops applying soon after you deploy.
Redirects apply from the first request, including to a site no edge node had cached yet (since v0.0.105).
Limits
- Level 0 sites only. At Level 1 and Level 2 the edge can’t read the list of files inside the site, which is the point of those levels, so it can’t read
_redirectseither. - Lines the edge ignores: country or language conditions, query-parameter matching, and rules whose source is a whole domain. They’re skipped rather than half-applied, so a condition can never turn into a rule for every visitor. Rewrites (200) and 404 rules work since v0.0.107.
- Checked when you build. Since the builder
ee-cdn-clidownloads was updated on 2026-09-29, a redirect loop or an unsupported status such as 307 stops the build with the line and the reason.