Cool URIs don't change
- Published at
- Updated at
- Reading time
Years ago, I took over a small freelance project for an art gallery. They've been running on a homegrown CMS, and I ported things to WordPress. Guess what happened after releasing the rebuilt site?
Within a day, a furious gallery owner told me I had broken Google. What? Google doesn't work anymore? What happened? Well... I didn't care about the URLs and changed everything to WordPress's default schema.
The lesson: Cool URIs don't change. And I've just read an article by Tim Berners-Lee (the inventor of the World Wide Web) written in 1998.
That was fifteen years ago, and yet it holds much wisdom.
Let it be search engines, other sites or people storing your resources in their bookmarks — changing URLs sucks. People will curse you. You're breaking the web.
I made the major mistake of letting WordPress choose my URLs for me. Of course, that wasn't Wordpress's fault but rather my greenhorn oversight. But the problem still holds for any technology out there.
Next.js, Netlify, Amplify — frameworks and hosters — come with URL defaults. What happens if I change frameworks or hosting? Will I break my URLs? How often do I map something living in the
directory to something futureproof? Well, the answer is: rarely.
Alright, captain! I'm not a webmaster but phew, that's easier said than done in practice. For example, this post here lives under a
/notes/* URL. I thought it's fancy at first, but it's not a great future-proven URL. What happens if I restructure the content types (notes, blogs, tilPosts) on my blog? Will
/notes/ still make sense? I doubt it.
And again, the technology I use (Contentful/Eleventy) decided on the URL structure – it was again me not thinking long-term.
URLs will be tough forever, but we simply have to try to avoid link rot. Give "Cool URIs don't change" a read if you want some URL inspiration.
And a sidenote: if you don't put dates and metadata on your pages, please start doing it. If URLs don't change, it's important to know when things were created or updated. 😉