I'm looking for a way to make sure that all of my urls end with a trailing slash (so first check if there is already a trailing slash at the end, and if not add one).
I have tried with nuxt-redirect-module, and it works adding the slash but then it leads to an infinite redirect
redirect: [
{
from: '^(.*)$',
to: (from, req) => {
let trailingUrl = req.url.endsWith('/') ? req.url : req.url + '/'
return trailingUrl
}
}
]
Any insight will be welcome. Thanks!