This tutorial covers creating a Data model to configure server-side redirects in Builder. A server-side redirect is a technique for rerouting site traffic from one web address to another. For example, if you create a Page and later want to reroute visitors to another Page that has a different URL, you'd set up a URL redirect.
Use cases for server-side redirects include:
- Reroute traffic to an updated Page from an outdated one.
- Phase out an old URL without breaking links to the old URL.
- Redirect traffic when you're updating URL naming conventions.
Youʻll need an evergreen browser; that is, a modern, up-to-date browser such as Google Chrome.
- Go to Models.
- Click the + Create New button.
- Name and describe your model. This example uses the Name URL Redirects and the Description Manage URL redirects for site content.
- Add a custom field by clicking on the + New Field button. Name the first new field
sourceUrl
with a Type ofUrl
. - Repeat the previous step for a field called
destinationUrl
of TypeUrl
and a third field calledredirectToPermanent
of TypeBoolean
. - Click Save.
The following video goes through the above steps:
Tip: When you configure your codebase to use the redirect later in this tutorial, you'll need the name of the model you just created. The name, known as the Unique identifier in the Builder UI, in this example is url-redirects
, which you can find by clicking the Show More button.
For a video pointing out the location of the name, refer to the Finding the model name section of Data Models.
The next step is to use the Data model you just made. Here you make a Data content entry to redirect a URL called /site/intro
to /site/getting-started
.
- Go to Content.
- Click the + New button.
- Select URL redirect.
- For the
SourceUrl
, enter/site/intro
. - For the
DestinationUrl
, enter/site/getting-started
. - Name the new content entry
/site/intro -> /site/getting-started
. This way, when the URL Redirects are listed in the content area of Builder, each redirect's purpose is in the name, so you don't have to open them to see the URLs that are being redirected. - Click Save.
This video shows the process of making a server-side-redirect as outlined above:
To get even more out of Data models with Builder, check out Integrating CMS Data.
For more general information on Data models, refer to the Data Models documentation.