Redirects.
A redirect maps an old path to a new one. When you move or rename a page, a redirect keeps the old link working by sending visitors, and search engines, on to the new location.
Redirects are records stored on your site, one per rule. The platform applies them for you at request time, so once a rule is in place the old address keeps working without anything in your templates.
What a redirect holds
A redirect has a source path and a destination path, plus the status to answer with. The source is stored as from_path and the destination as to_path. The status_code is the HTTP status the platform replies with, either 301 or 302, and it defaults to 302. An optional kind records what the rule was created for.
| Field | What it is |
|---|---|
from_path | The old path to match, for example /old-page. A trailing * makes it a prefix match. |
to_path | The path to send the visitor to. |
status_code | The HTTP redirect status: 301 (permanent) or 302 (temporary). Defaults to 302. |
kind | An optional marker for how the rule was created. |
Reach for 301 when the move is permanent and you want search engines to follow it and update their index; 302 keeps the change temporary.
How they are applied
When a request arrives, the platform checks the site's redirects before it resolves the page. It first looks for a rule whose source matches the requested path exactly; failing that, a wildcard rule whose source ends in * matches any path that starts with the same prefix. On a match it answers with an HTTP redirect to the destination, using the rule's own status code.
Because this check runs before the page is resolved, a redirect at a given path takes precedence over a template or post at that same path. This is one step of the render pipeline, which walks the whole request from host to response.
Listing redirects
A template can read the site's redirects with the {% collection redirects, items %} tag, for instance to build an audit list of the rules in place.
{% collection redirects, items %}
>
{% for r in items %}
- >{{ r.from_path }} to {{ r.to_path }} ({{ r.status_code }})
>
{% endfor %}
>See Data sources for the filters and paging the {% collection %} tag accepts.