HomeThe Classics

A Strategy for Keeping My URLs Cool

Published:

There’s an old web principle which argues that “Cool URLs Live Forever”. The idea being that every published URL on a site should stay online forever, or at least redirect elsewhere or show a reasonable error. As Jacob explains, they should last forever because:

  • it prevents link rot, which is a huge problem (particularly in the legal system),
  • users might have relied on that link, either through a bookmark or a handy reference and,
  • users who use search engines might not get an updated version of the site.

I want to try this but tracking redirects is a lot of work. If I’m to do it in my static site generator Hugo, I’d have to add an alias to the post in question whenever the page redirects. Given the many versions of my personal site, the same post can be at multiple locations. Instead of trying to keep track of them, why not adopt a smarter approach?

What if I detected 404s as they come up and I decide how to handle them there and then? If it were a misspelt link, I could fix it but if it were nonsense, I could leave it alone. Sounds like a good use of Cloudflare Workers.