Redirects
Send old addresses to the pages that replaced them, with a permanent or temporary redirect, from Site settings or through an agent.
A redirect sends anyone who opens an old address to the page that replaced it. Use one when a page changes address, or when a site moves to Libretto and the old site's links must keep working. The server answers the redirect before any page loads, so visitors, search engines and link checkers all see the move.
Before you start #
You need the right role and a clear list of old and new addresses.
- Role: the Redirects tab needs the Super admin role, or owning the site's workspace.
- Old addresses: write each as a path of this site, such as
/old-page. A language other than the main one keeps its prefix:/en/old-page. - New addresses: a path of this site, such as
/about, or a fullhttps://address on another site.
Add a redirect #
Each row of the table is one redirect.
- In the sidebar, open Site settings and choose the Redirects tab.
- Select Add redirect. A new row appears.
- In Old address, type the path to send away, such as
/2. - In Goes to, type the path or address it leads to, such as
/team. - In Type, keep Permanent (301), or choose Temporary (302) for a move you will undo.
- Select Save redirects.
The message "Redirects saved. They go live with the next publish." confirms it. Publish the site to make the redirect live: until then, the public site keeps answering the old address as before.
Redirect a whole section #
End the old address with /* to send a path and everything under it to one place.
- Example:
/blog/*sends/blog,/blog/2019and/blog/2019/springto the same new address. - Precedence: a row with the exact address wins over a
/*row. Between two/*rows, the longer path wins. - Query: when the new address has no
?part of its own, the visitor's query is kept:/old?ref=mailleads to/new?ref=mail.
Fix a refused row #
A row with a problem shows a message under its cell, and Save redirects stays disabled until you fix it.
- "Write a path that starts with /…": the old address has a
?, a#or a space, or a*that is not at the end after/. - "Write a path that starts with /, or a full https:// address.": the new address is neither.
http://addresses are refused. - "Another row already redirects this address.": two rows have the same old address. A final
/does not count, so/oldand/old/are the same. Remove one. - "This row leads back to an address that is redirected again.": the rows form a loop, such as
/ato/band/bto/a. Point the row to a page. - "This address belongs to the platform itself…": addresses under
/admin,/apiand/_cannot be redirected.
The save itself can be refused too, with the problems listed under the table. A message such as "Redirect 2 (/team) would hide the published page at /team" means the old address is the address of a published page: the redirect would make the page unreachable. Change the page's address or unpublish it first. An unpublished page's address can be redirected.
Remove a redirect #
- In the row, select Remove.
- Select Save redirects, then publish.
The old address answers as it did before the redirect: the page there, or "page not found".
Undo and versions #
Redirects are saved with the site's settings, so they follow the same rules as your other changes.
- Undo restores the previous list in the draft. After a publish, publish again to put the restored list live.
- Publish makes the current list live. Making an earlier version live brings back that version's redirects.
With an agent #
An agent connected to the site can read and replace the list with the operations redirects.read and redirects.update (see the Redirect operations page in the reference). redirects.update takes the whole list, { "redirects": [{ "from": "/old", "to": "/new", "status": 301 }] }, and refuses it with the same problems listed above.
Something wrong on this page? Write to docs@librettocms.com.