Redirects
Last edit: Oct 26, 2022
Redirects are used to redirect one page to another using an HTTP status code.
Example
Redirecting /my-page to /other-page using the 302 status:
---
redirect_to: /other-page
redirect_code: 302
---
Example 2
Usage params from GET request inside the redirect_to
option to make SEO friendly redirects from one URL pattern to another.
Redirecting /cars?maker=honda
to /category/cars/honda
using the 301 status:
---
redirect_to: '/category/cars/{{ context.params.maker }}'
redirect_code: 301
---
Properties
Name | Description |
---|---|
slug |
defines the URL at which this page will be accessible. In this example, assuming your site's domain is https://example.com , you will be able to access the page at https://example.com/my-page |
redirect_to |
endpoint which you want the user to be redirected to |
redirect_code |
specifies the status of redirection. Can be either 301 (Moved Permanently) or 302 (Found) |