[object Object]

← back to Vinylwallpaper

301 redirect legacy *.html nav pages -> clean URLs (before express.static, kills duplicate-content)

d8b7ebdf284c3aa23053b700c137c007ffc09179 · 2026-06-01 07:54:16 -0700 · Steve Abrams

Files touched

Diff

commit d8b7ebdf284c3aa23053b700c137c007ffc09179
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Mon Jun 1 07:54:16 2026 -0700

    301 redirect legacy *.html nav pages -> clean URLs (before express.static, kills duplicate-content)
---
 server.js | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/server.js b/server.js
index 5b67c23..9421927 100644
--- a/server.js
+++ b/server.js
@@ -176,6 +176,11 @@ for (const [route, file] of Object.entries(CLEAN_PAGES)) {
   app.get('/' + route, (req, res) => res.sendFile(path.join(__dirname, 'public', file)));
 }
 
+// Canonicalize: 301 legacy *.html forms -> clean URLs (runs before static so
+// the .html copies in public/ aren't served as duplicate-content). /index.html -> /.
+app.get(/^\/(history|care|trade|sourcing)\.html$/i, (req, res) => res.redirect(301, '/' + req.params[0].toLowerCase()));
+app.get('/index.html', (req, res) => res.redirect(301, '/'));
+
 app.use(express.static(path.join(__dirname, 'public')));
 
 app.get('/api/products', (req, res) => {

← 1dff83d fix: block .bak-<timestamp> files from being served (regex m  ·  back to Vinylwallpaper  ·  noopener,noreferrer on sister-site constellation window.open d54a830 →