← back to Corkwallcovering
add 301 redirect from legacy /*.html to clean URLs (before express.static); /index.html -> /
4f70040731b094780386001e267d528af2164c01 · 2026-06-01 07:24:46 -0700 · Steve Abrams
Files touched
Diff
commit 4f70040731b094780386001e267d528af2164c01
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Mon Jun 1 07:24:46 2026 -0700
add 301 redirect from legacy /*.html to clean URLs (before express.static); /index.html -> /
---
server.js | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/server.js b/server.js
index dba1025..61819dd 100644
--- a/server.js
+++ b/server.js
@@ -63,6 +63,14 @@ app.use(require('../_shared/api-vendor-redact'));
require('./_universal-contact')(app, { siteName: "Cork Wallcovering", zdColor: "#a87030", zdPosition: 'right' });
require('./_universal-auth')(app, { siteName: "corkwallcovering" });
+// Clean-URL canonicalization — 301 legacy /foo.html to /foo. Runs BEFORE
+// express.static so the .html form never serves directly (avoids duplicate
+// content). The {extensions:['html']} option below resolves /foo -> foo.html.
+app.get(/^\/(.+)\.html$/i, (req, res, next) => {
+ const clean = '/' + req.params[0];
+ if (clean === '/index') return res.redirect(301, '/');
+ res.redirect(301, clean);
+});
app.use(express.static(path.join(__dirname, 'public'), { extensions: ['html'] }));
// DW STANDARD: sort by color/style/sku/title for any product-rendering site.
← 4d7b5b5 fix /api/facets to count over the active filtered set (drill
·
back to Corkwallcovering
·
add noopener,noreferrer to sister-site window.open popup a771d32 →