Redirected to the valid url

This commit is contained in:
Sweta271097 2019-10-20 19:00:50 +05:30 committed by Sean Yesmunt
parent dbaf98412f
commit 8e25119800

View file

@ -71,7 +71,7 @@ app.get('*', async (req, res) => {
const urlPath = req.path.substr(1); // trim leading slash
if (!urlPath.startsWith('$/') && urlPath.match(/^([^@/:]+)\/([^:/]+)$/)) {
return res.redirect(301, req.url.replace(/([^/:]+)\/([^:/]+)/, '$1:$2')); // test against urlPath, but use req.url to retain parameters
return res.redirect(301, req.url.replace(/^([^@/:]+)\/([^:/]+)(:(\/.*))/, '$1:$2')); // test against urlPath, but use req.url to retain parameters
}
if (urlPath.endsWith('/') && urlPath.length > 1) {