リダイレクト
Every website has the need for redirects. For example if you relocate or delete content, you want your users to still be able to find it or the next best thing. See the document Authoring and Publishing Content for more information on deleting content.
You can intuitively manage redirects as a spreadsheet called redirects
(or redirects.xlsx
) in the root of your project folder.
The spreadsheet has to contain at least two columns titled Source
and Destination
.
- The
Source
is relative to the domain of your website, so it only contains the relative path. - The
Destination
can be either a fully qualified URL if you are redirecting to a different website, or it can be a relative path if you are redirecting within your own website.
After making changes to your redirects spreadsheet, you can preview your changes via the sidekick and have your stakeholders check that the redirects are working on your .page
preview website before publishing the redirect changes to your production website. See the Sidekick documentation for more information about switching between environments.
Redirects take precedence over existing content, which means that if you have an existing page with a given URL, defining a redirect for that same URL will serve the redirect for that page and “hide” the existing page. Conversely if a redirect that has been set up on an existing page is removed, the existing page will be served again, unless the page was unpublished.
Remember that if your redirect workbook has multiple pages (worksheets), then the redirects will only work on the sheet that is called helix-default
. This allows you to manage more complex redirects through spreadsheet formulas. The spreadsheets and JSON documentation page has all the details.