# Redirect rule reference

> Fields of a redirect rule, their defaults, how they are normalized and the limits that apply.

Redirect rules are the `redirects` list of a zone's edge settings. A `PATCH` replaces the whole list. Unknown fields are rejected.

| Field | Default | Rules |
|---|---|---|
| `host` | — | Required. A full name of the zone (the zone or below it), no wildcard. Stored in lower case without a trailing dot. |
| `path_prefix` | `/` | Starts with `/`; no `?`, `#`, spaces or control characters; at most 1024 characters. Stored in canonical form: non-ASCII and reserved characters as upper-case `%XX` (`/año` and `/a%c3%b1o` are both stored as `/a%C3%B1o`; `%2F` counts as `/`). Unique per `host`. |
| `target` | — | Required. Absolute `http://` or `https://` URL, at most 2048 characters, without `user:password@`, fragment or spaces; may carry a query. The scheme is stored in lower case and non-ASCII bytes of path and query as `%XX`; write the host in ASCII (punycode for international names). |
| `preserve_path` | `true` | Append the rest of the path after the prefix. |
| `preserve_query` | `true` | Append the request's query string. |
| `status` | `301` | `301`, `302`, `307` or `308`. |

## Limits

- At most 50 rules per zone.
- A rule can't redirect to its own `host` on a path it captures.
- Redirect rules can't be set per name under `hosts`: each rule already names its `host`.

## Errors

Invalid rules are rejected with `422` and a message that names the rule, for example `redirects[0].host: "shop.example.org" is not a name of the zone example.com`.
