Skip to content

Seo optimisation - fix redirects#34

Merged
mneveroff merged 4 commits into
mainfrom
seo-optimisation
Jun 16, 2026
Merged

Seo optimisation - fix redirects#34
mneveroff merged 4 commits into
mainfrom
seo-optimisation

Conversation

@mneveroff

@mneveroff mneveroff commented Jun 16, 2026

Copy link
Copy Markdown
Owner

Summary

Hotfix for a redirect loop on /lens/ introduced in #33.

After the SEO redirect work shipped, https://weeforest.org/lens/ returned ERR_TOO_MANY_REDIRECTS. The root cause was an app.get('/lens/', …) handler that called next() on clean requests; the Astro static fallback (extensions: ['html']) then handled the same path and issued another 301 → /lens/, looping forever.

This PR replaces the Lens app.get routes with app.use middleware that only redirects when it should:

  • /lens/lens/ (trailing slash)
  • /lens/?ref=… (and other query variants) → /lens/ (strip tracking params)

Clean GET /lens/ requests pass through to Lens static and return 200.

Context

#33 added Ghost-era URL cleanup and SEO improvements after the Astro migration:

  • 301s for /home/, /author/*, and /sitemap.xml
  • robots.txt with sitemap-index.xml
  • Lens canonical tag and /lens/ in the Astro sitemap
  • Explicit robots.txt route from the Astro dist

Those changes remain on main; this PR only fixes the Lens redirect regression.

Test plan

  • curl -sI http://localhost:3939/lens/200
  • curl -sI 'http://localhost:3939/lens?ref=test'301/lens/
  • curl -sI 'http://localhost:3939/lens/?ref=test'301/lens/
  • Browser: http://localhost:3939/lens/ loads the map
  • After deploy: curl -sI https://weeforest.org/lens/200
  • After deploy: curl -sI https://weeforest.org/home/301/
  • Resubmit https://weeforest.org/sitemap-index.xml in Google Search Console

Post-deploy (manual)

  1. Verify production /lens/ loads (not redirect loop).
  2. In GSC: add sitemap-index.xml, remove stale sitemap.xml entry if still present.
  3. If Cloudflare still serves its managed robots.txt, disable that so origin robots.txt is used.

@mneveroff mneveroff merged commit 7f8d8ac into main Jun 16, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant