← back to Museumwallpaper
301 redirect legacy /*.html -> clean URLs (before express.static) to kill duplicate-content reachability
43aaeba4e23176220aea970273b83b1f274df826 · 2026-06-01 07:36:44 -0700 · Steve Abrams
Files touched
Diff
commit 43aaeba4e23176220aea970273b83b1f274df826
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Mon Jun 1 07:36:44 2026 -0700
301 redirect legacy /*.html -> clean URLs (before express.static) to kill duplicate-content reachability
---
server.js | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/server.js b/server.js
index 290d2e5..f281ff7 100644
--- a/server.js
+++ b/server.js
@@ -167,6 +167,20 @@ app.use((req, res, next) => {
}
next();
});
+// Canonicalize: 301 the legacy *.html form of every page to its clean URL so
+// express.static doesn't serve a duplicate-content copy. Must run BEFORE static.
+const LEGACY_HTML = {
+ '/index.html': '/',
+ '/history.html': '/history',
+ '/care.html': '/care',
+ '/trade.html': '/trade',
+ '/sourcing.html': '/sourcing',
+ '/vocabulary.html': '/vocabulary',
+};
+for (const [legacy, clean] of Object.entries(LEGACY_HTML)) {
+ app.get(legacy, (req, res) => res.redirect(301, clean));
+}
+
app.use(express.static(path.join(__dirname, 'public')));
// Clean-URL routes for extension-less nav links → static HTML pages.
← 7dcaf0b fix: remove public/index.html.bak-20260526152130 source leak
·
back to Museumwallpaper
·
Remove Big Red widget — never UX-worked, collided with Help cc19398 →