[object Object]

← back to Silkwallpaper

301 redirect legacy .html nav pages to clean URLs (kill duplicate-content served by static)

412c2ddac4bd8b9fddae3bb2441cb3c75fee66b3 · 2026-06-01 07:50:59 -0700 · Steve Abrams

Files touched

Diff

commit 412c2ddac4bd8b9fddae3bb2441cb3c75fee66b3
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Mon Jun 1 07:50:59 2026 -0700

    301 redirect legacy .html nav pages to clean URLs (kill duplicate-content served by static)
---
 server.js | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/server.js b/server.js
index e2f69ef..cbc1ee9 100644
--- a/server.js
+++ b/server.js
@@ -154,6 +154,14 @@ app.use(express.json({ limit: '256kb' }));
 require('./_universal-contact')(app, { siteName: "silkwallpaper", zdColor: "#c8a060", zdPosition: 'right' });
 require('./_universal-auth')(app, { siteName: "silkwallpaper" });
 
+// 301 legacy .html → clean URL (the static .html pages were served at both
+// /history and /history.html = duplicate content; canonicalize to clean form).
+// Mounted BEFORE express.static so it intercepts the .html request first.
+app.get(/^\/(history|vocabulary|sourcing|care|trade|about|index)\.html$/i, (req, res) => {
+  const slug = req.params[0].toLowerCase();
+  res.redirect(301, slug === 'index' ? '/' : '/' + slug);
+});
+
 app.use(express.static(path.join(__dirname, 'public')));
 
 app.get('/api/products', (req, res) => {

← f2a3aef noopener,noreferrer on sister-site constellation window.open  ·  back to Silkwallpaper  ·  gitignore: broaden *.pre-*.bak to *.pre-* to catch pre-fix s 1f4aa21 →