← back to Hotelwallcoverings
Add 301 redirect from legacy .html URLs to clean-URL form
0e2ca52c030606bd1abd17b636d9260cc8f82d03 · 2026-06-01 07:33:35 -0700 · Steve Abrams
Files touched
Diff
commit 0e2ca52c030606bd1abd17b636d9260cc8f82d03
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Mon Jun 1 07:33:35 2026 -0700
Add 301 redirect from legacy .html URLs to clean-URL form
---
server.js | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/server.js b/server.js
index 88b38d6..ce30d4b 100644
--- a/server.js
+++ b/server.js
@@ -158,6 +158,14 @@ app.use((req, res, next) => {
require('./_universal-contact')(app, { siteName: "Hotel Wallcoverings", zdColor: "#d4a847", zdPosition: 'right' });
require('./_universal-auth')(app, { siteName: "hotelwallcoverings" });
+// Clean-URL canonicalization: 301 the legacy .html form to the extension-less
+// URL so the static dir doesn't serve duplicate content (SEO). Runs BEFORE
+// express.static so /care.html never resolves to the raw file.
+app.get(/^\/(care|history|sourcing|trade|vocabulary)\.html$/, (req, res) => {
+ res.redirect(301, '/' + req.params[0]);
+});
+app.get('/index.html', (req, res) => res.redirect(301, '/'));
+
app.use(express.static(path.join(__dirname, 'public')));
app.get('/api/products', (req, res) => {
← e801b38 fix: remove public backup file leak + add *.bak-* to .gitign
·
back to Hotelwallcoverings
·
Pass noopener,noreferrer to sister-site window.open popup 9f5acd1 →