Redirects
Configuration#
Redirects are configured in your scalar.config.json file under the siteConfig.routing.redirects section:
{
"$schema": "https://registry.scalar.com/@scalar/schemas/config",
"scalar": "2.0.0",
"siteConfig": {
"routing": {
"redirects": [
{
"from": "/old-path",
"to": "/new-path"
}
]
}
}
}Wildcard Redirects#
You can use wildcards to redirect multiple paths with a single rule:
{
"from": "/old-path/:wildcard",
"to": "/new-path"
}This will redirect /old-path/whatever-that-is to /new-path.
Or, if you have a specific prefix:
{
"from": "/old-path/12345-:wildcard",
"to": "/new-path"
}This will redirect /old-path/12345-whatever-that-is to /new-path.
Regex Redirects#
You can even use regular expressions in your redirects:
{
"from": "/old-path/:pathMatch(.*)*",
"to": "/new-path"
}