Simple redirect middleware for Express
No config implemented
const redirect = require('./middleware/redirect');
this.server.use(redirect(this, this.config.redirect));
{
"redirect": {
"enabled": true,
"debug": false,
"status": 307,
"redirectUppercase": true,
"redirectTrailingSlash": true,
"redirectDrupalRoutes": false,
"redirectPrismicRoutes": false,
"redirects": {
"static": {},
"regex": {}
}
}
}
Static redirect example:
{
"redirects": {
"static": {
"/5-sdn-benefits-for-data-centers": "/blog/5-sdn-benefits-for-data-centers",
"/about/company": "/about",
"/about/leadership/bill-stein": "/about/leadership/a-william-stein",
"/about/leadership/joshua-mills/Joshua": "/about/leadership/joshua-mills",
"/about/leadership/scott": "/about/leadership/scott-peterson",
"/about/our_leadership": "/about/leadership",
"/apac-redirect": "https://www.digitalrealty.asia"
}
}
}
Regex redirect example:
{
"redirects": {
"regex": {
"^/assets/img(.*)": "https://s3-us-west-1.amazonaws.com/production.digitalrealty.craft.public/legacy/img/$1",
"^/storage/(.*)": "https://s3-us-west-1.amazonaws.com/production.digitalrealty.craft.public/legacy/storage/$1",
"^/data-centres/?$": "/data-centers",
"^/data-centres/(.*)": "/data-centers/$1",
"^/data-centre-(services|solutions).*$": "/data-center-solutions"
}
}
}
No links available
Last modified | Monday, August 2, 2021, 2:25:06 PM UTC |
Last author | Glenn de Haan |
Commit ID | 8692065 |