Skip to main content
A _redirects file lists rules that redirect, rewrite or proxy matching URLs on a static site, or answer them with a custom 404 page. Sevalla reads the file at every deployment and applies its rules at the edge. It uses Netlify’s _redirects format, without the parts listed in Unsupported features. For trailing slashes and extension-less URLs, turn on pretty URLs instead of writing rules.

Add a redirects file

1

Create the file

Create a file named _redirects, with no extension, so that it ends up in the publish directory. Many generators copy the files of a public folder into their output. Sevalla also finds the file in the build’s root directory, but looks in the publish directory first.
2

Add the rules

Write one rule per line. See Rule syntax.
3

Deploy

Commit and push the file, then deploy the site if the push doesn’t.
The deployment’s log says it found the _redirects file, then Redirects processed successfully!. Sevalla doesn’t publish the file itself: /_redirects returns 404. Changes to the file apply from the next deployment.
If any line can’t be parsed, the log shows There were errors while parsing your redirect rules: with the line and the reason, and the deployment is published without any of the file’s rules. The deployment still succeeds, so check the log after you change the file.

Rule syntax

_redirects
Each rule is one line of fields separated by spaces or tabs:
Blank lines are ignored, and # starts a comment, at the start of a line or after a rule. A line Sevalla can’t read fails with Missing destination path/URL, The destination path/URL must start with "/", "http:" or "https:", or Invalid status code (for example, conditions without a status code). How from paths match:
  • Case doesn’t matter, and a trailing slash is optional: /old-page matches /old-page, /old-page/ and /Old-Page.
  • The whole path must match. /docs doesn’t match /docs/guide; use a splat for that.
  • Write spaces and non-ASCII characters percent-encoded, as browsers send them: /caf%C3%A9, not /café.
  • Paths with (, ), {, }, ? or + can’t be matched.

Status codes

Use only these codes. Sevalla skips a rule with any other status code, such as 410. For redirects (301 to 308), a to path stays on the domain that was requested. When the rule has no query parameters and to has no ?, Sevalla adds the request’s query string to the target: with the rule /shop /store, /shop?ref=mail redirects to /store?ref=mail.
_redirects

Rewrite a URL

A rule with status 200 serves another file at the requested URL. The address in the browser doesn’t change.
_redirects
The target must be a file in the deployment, written as its full path: /pricing-2026.html or /blog/index.html. Folder URLs such as /blog/ and extension-less paths such as /about don’t resolve as rewrite targets.

Proxy another site

When to is a full URL, a 200 rule fetches that URL and returns its response at your URL:
_redirects
Sevalla sends the request’s method to the other site, without the request’s body or headers. It caches successful GET and HEAD responses at the edge like the site’s own files (for 30 days, or until the next deployment) and removes their Set-Cookie headers. Proxy only public content that can be cached; call APIs from the browser instead.

Custom 404 pages

A 404 rule serves a page of your own, with status 404, for URLs that have no file:
_redirects
Because these rules aren’t forced, they apply only when no file matches the URL. Put the more specific paths first. If the target file doesn’t exist, Sevalla serves its own 404 page. The Error file build setting also serves a page for URLs without a file, but with status 200. Search engines then index missing URLs as real pages, so use a 404 rule for a 404 page. Without either, Sevalla serves its own 404 page with status 404.

Force a rule

By default, a rule doesn’t apply when the requested URL matches a file in the deployment, so a rule can’t hide a page that exists. Add ! after the status code to apply the rule anyway:
_redirects
This redirects every /docs/v1/ URL, even though the version 1 files are still in the deployment. A URL matches a file when the site would serve one for it: the file itself, the Index file of a folder, and, with pretty URLs on, about/index.html or about.html for /about/.

Splats

A * at the end of from, after a /, matches the rest of the path, slashes included. Use :splat in to to insert what it matched:
_redirects
/news/2026/launch redirects to /blog/2026/launch. The rule matches /news/ and everything below it, but not /news. A splat works only at the end of the path. A * anywhere else, as in /docs/*.html, makes the rule invalid, and requests that reach it fail.

Placeholders

A :name segment in from matches one path segment, the text between two slashes. Use the same name in to:
_redirects
/store/audio/headphones redirects to /products/audio/headphones. Use each placeholder once in to.

Query parameters

List query parameters between from and to. key=:name captures the parameter’s value as a placeholder; key=value requires that exact value:
_redirects
  • The request must have exactly the listed parameters, no more and no fewer, in any order. /search?q=laptops matches the first rule; /search?q=laptops&sort=asc doesn’t.
  • List combinations from the most parameters to the fewest, as for /items, so the right rule matches first.
  • A rule with query parameters doesn’t pass the query string on. Use the captured values in to instead.

Header conditions

A Header:Name=value condition after the status code applies the rule only to requests that carry that header with that value:
_redirects
  • The header name isn’t case-sensitive. The value is, and it must equal the whole header value: a request with Accept: text/markdown, text/html doesn’t match text/markdown.
  • Allow more than one value with commas and no spaces: Header:X-Variant=b,c matches b or c.
  • Leave the value empty to require only the header: Header:X-Preview= matches any value.
  • Add more than one condition with spaces between them: all must match.
  • A request without the header skips the rule.
Pair header conditions with a redirect status. Use 302 or 307 rather than 301, because browsers remember 301 redirects without checking the header again. Sevalla caches responses by URL, so a header-conditioned rewrite (200) can return the rewritten file to requests without the header.

Redirect one domain to another

A full URL in from matches only requests to that domain. To send every www request to the apex domain:
_redirects
Both domains must be custom domains of the same static site. The ! makes the rule apply to URLs that have a file too.

Rule order

Sevalla checks rules from the top of the file and applies the first one that matches. A rule whose query parameters or header conditions don’t match is skipped, and the next rule is checked. Put specific rules above general ones: a /* rule at the top catches everything below it.

Serve a single-page application

For a single-page application whose router handles paths in the browser, serve index.html for every URL that has no file:
_redirects
The rule isn’t forced, so JavaScript, CSS and image files are still served as they are. Keep pretty URLs off unless your router expects trailing slashes.

Pretty URLs

Pretty URLs give every page URL a trailing slash: Sevalla redirects (301) /about and /about.html to /about/, and serves about/index.html or about.html there. Search engines see one URL per page. It’s off for new sites. With pretty URLs off, folder URLs use the Index file build setting, and /about doesn’t serve about.html. If your generator writes pages as about.html, turn pretty URLs on. The trailing-slash redirect keeps the query string. Your _redirects rules then run on the /about/ request, and rules written as /about or /about.html match it.
1

Open the pretty URLs setting

In the sidebar, click Static sites, then click the site. Click the Settings tab and, under Redirects, click Enable pretty URLs.
2

Confirm

In the dialog, click Enable pretty URLs.
3

Purge the cache

Click the Networking tab, then click Purge cache, so the edge stops serving responses it cached before the change.
The Pretty URLs section shows Status Enabled. The setting applies to every domain of the site right away, without a deployment, but not to pull request previews. To turn it off, click Disable pretty URLs, confirm, and purge the cache again.
The Redirects group on a static site's Settings tab: Pretty URLs with Status Disabled and the Enable pretty URLs buttonThe Redirects group on a static site's Settings tab: Pretty URLs with Status Disabled and the Enable pretty URLs button

Unsupported features

Sevalla reads Netlify’s line format, but not every Netlify feature:
  • Conditions other than Header:, such as Country=, Language=, Role= and Cookie=, are ignored. A rule with only these conditions applies to every request.
  • Signed proxy rules (Sign=) aren’t signed.
  • Status codes other than 200, 301, 302, 303, 307, 308 and 404.
  • A * anywhere but the end of from.
  • Rules in netlify.toml, and the custom headers they can set per rule. For headers, use a _headers file.
A rule copied from Netlify with a Country= or Language= condition redirects every visitor, not only the ones it names. Remove such rules, or replace the condition with a header condition.
If a rule doesn’t work as expected, see Troubleshoot static sites.

API and CLI