Skip to content

Commit 8a8c88e

Browse files
committed
fix: server.js bug
1 parent bfb492a commit 8a8c88e

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

next.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const { i18n } = require('./next-i18next.config');
99

1010
module.exports = withBundleAnalyzer({
1111
i18n,
12+
trailingSlash: false,
1213
reactStrictMode: false,
1314
compress: true, // 启用压缩
1415
eslint: {

server.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,12 @@ async function startServer() {
7171

7272
req.locale = locale;
7373

74-
// 处理尾部斜杠并重定向
75-
if (req.url.length > 1 && req.url.endsWith('/')) {
76-
const newUrl =
77-
req.url.slice(0, -1) +
78-
(req.url.includes('?') ? req.url.slice(req.url.indexOf('?')) : '');
79-
return res.redirect(301, newUrl);
80-
}
74+
// // 处理尾部斜杠并重定向
75+
// if (req.url.length > 1 && req.path.endsWith('/')) {
76+
// const newUrl =
77+
// req.path.slice(0, -1) + req.params
78+
// return res.redirect(301, newUrl);
79+
// }
8180

8281
next();
8382
}

0 commit comments

Comments
 (0)