Redirected to the valid url
This commit is contained in:
parent
dbaf98412f
commit
8e25119800
1 changed files with 1 additions and 1 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Reference in a new issue