Cool URIs don't change
- Published at
- Updated at
- Reading time
- 2min
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.
When you change a URI on your server, you can never completely tell who will have links to the old URI.
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.
Tim says:
It is the the duty of a Webmaster to allocate URIs which you will be able to stand by in 2 years, in 20 years, in 200 years. This needs thought, and organization, and commitment.
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. ๐
With social media being a huge content resource today,
. Very smart!Join 5.4k readers and learn something new every week with Web Weekly.