[
{
"from": "string", // (required): The path. Supports regexp syntax.
"to": "string", // (required): The destination path.
"status": "number", // (optional): The HTTP Status Code for redirect. Default is empty.
"assets": "boolean" // (optional): Whether to apply the redirect/rewrite to any static file that is not an html file. Default is false.
}
]
[
{
"from": "stormkit.io",
"to": "www.stormkit.io",
"status": 301
}
]
If you omit the status
property, Stormkit will not redirect the request but will simply rewrite the path.
[
{
"from": "/my-path/*",
"to": "/my-new-path/$1",
}
]
In this case, all requests coming to my-path
will be served as if they were coming to my-new-path
.
[
{
"from": "/*",
"to": "/index.html",
"assets": false,
}
]
The above example will rewrite all requests to index.html
. By setting assets
false This is useful for single page applications.
[
{
"from": "/documentation/*/page/*",
"to": "/docs/$1/$2"
},
{
"from": "/documentation$",
"to": "/docs"
}
]
You can use regexp
syntax for redirects. The example above creates two redirects.
/documentation/welcome/page/getting-started
to /docs/welcome/getting-started
./documentation
to /docs
.Note the $amp;
sign at the end of the string. That sign simply tells to redirect only the path /documentation
and not anything that contains /documentation
.