← back to Screenprintedwallpaper
seo: 301 redirect legacy .html editorial pages to clean URLs before static serve
1baf6481ca77fae41f69030c9513d3a29ad21fab · 2026-06-01 07:47:44 -0700 · steve
Files touched
Diff
commit 1baf6481ca77fae41f69030c9513d3a29ad21fab
Author: steve <steve@designerwallcoverings.com>
Date: Mon Jun 1 07:47:44 2026 -0700
seo: 301 redirect legacy .html editorial pages to clean URLs before static serve
---
server.js | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/server.js b/server.js
index 0d96ab2..2c32dcd 100644
--- a/server.js
+++ b/server.js
@@ -85,6 +85,14 @@ app.use((req, res, next) => {
}
next();
});
+// Canonical-URL 301: the editorial pages exist in public/ as *.html and are
+// also served clean (see CLEAN_PAGES below), so express.static would otherwise
+// serve BOTH /history and /history.html = duplicate content. Redirect the
+// legacy .html form (and /index.html) to the clean URL before static handles it.
+app.get(/^\/(index|history|care|sourcing|trade|vocabulary)\.html$/i, (req, res) => {
+ const base = req.params[0].toLowerCase();
+ res.redirect(301, base === 'index' ? '/' : `/${base}`);
+});
app.use(express.static(path.join(__dirname, 'public')));
// Color buckets for the "Color" sort — group similar hues via tag-match.
← edce735 fix: remove public backup file leak + fix bak-* middleware/g
·
back to Screenprintedwallpaper
·
Remove Big Red widget — never UX-worked, collided with Help a50db2c →