Redirect Managment
TinaDocs is built on top of NextJS, which supports static and dynamic redirects through the next.config.js
file located at the root of your project.
This allows for seamless integration of redirect rules during the build process, ensuring that your routes behave as expected across environments.
Setting Up Your Redirects
To update or add your redirects using the TinaCMS admin interface, follow these steps:
- Navigate to the `/admin` route of your site.
- In the sidebar, click on Settings.
- Scroll down to the bottom of the Settings page.
- Look for the Redirects section.
- Click + Add New to create a new redirect, or click an existing one to modify it.
Figure: Adding a redirect via the editor
Each redirect entry typically includes:
- Source Path (from)
- Destination Path (to)
- Permanent (boolean flag for 301 vs 302)
- Conditions (optional advanced rules)
Code-Defined Redirects
Here's what a redirect entry might look like in next.config.js
if manually defined: