Derek Sivers

Short URLs: why and how

2022-05-08

If you make your own website, consider making short URLs.

This is not about a URL shortener. This is about making your original URLs short in the first place.

Instead of:
yoursite.com/blog/2022/05/08/short-urls-why-and-how.html
… consider just:
yoursite.com/short

Why?

Short URLs matter for a few reasons:

That doesn’t mean the shorter the better. If I can remember “/plaintext” easier than “/pt”, then that’s a better choice.

How?

Here’s how I do it: Save my HTML file as the URL name, with no extension. Instead of “hi.html”, I save it as “hi” in my public web root.

Then, assuming the Nginx web server, add this line to my http block:

default_type text/html;

That’s it! That serves my files without extensions as HTML.

If I ever switch to a different system or server, there is always a way to pull up your HTML using a short URL.

Your thoughts?
Please leave a reply:


Comments

  1. Noah (2022-05-08) #

    I've always liked your short URLs. Nice to see the reason why they are so!

  2. Paul Butzi (2022-05-08) #

    Hmm. My first thought here is that I agree with the idea of optimizing the utility of URLs but I don't see shortness as the highest utility.

    Suppose I want to share my hypothetical 'first follower' post with the world. In the moment, I think "Now, what was the URL for that article I wrote long ago? Was it 'ff'? Or was that the article about foot fungus, or maybe the one about fast forward, or perhaps the one about forestry fundamentals?"

    If someone hears me speaking and wants to find my article on NVIS antennas, are they more likely to remember it when they get home if the URL is paulbutzi.com/na, or paulbutzi.com/NVISantennas?

    I like brevity and concision. I also like saying things in a way that's clear and which people can remember.

    So, to evaluate: what will the people listening to my presentation do with the time they saved by avoiding typing 'VIS' and 'ntennas'? Is that worth the reduction in memorability and clarity I get when I go from 'NVISantennas' to 'na'?

    Note that I am not advocating for URL's like "what-is-an-nvis-antenna-and-why-you-might-want-one?"

    Of course, the mapping from URLs to posts need not be bijective (one to one), it only needs to be surjective (every post must have at least one URL). So I needn't choose between 'nvisantennas' and 'na', I can have both although that substantially increases the administrative costs as I have to make sure I never generate collisions for either name.

  3. Olivian Breda (2022-05-08) #

    I admired and recommended your way of choosing URLs for years.

    Still, on my own website I tend to use one or two words, separated by hyphens.

    The thing is, if I receive a URL lie /su I will not understand what is the URL about, but /short-urls is clear & still, rather simple.

  4. Dharmesh Shah (2022-05-09) #

    +1 with you on beautiful, elegant, short URLs.

    Another thing I've also used is creating a domain name that redirects to a particular article/page. Example: SorryMustPass.org (which is easy for me to refer to when I need it).

  5. Vigilante (2022-05-09) #

    Short URLs are good for small blog.
    But you won't do this if you have something like reelgood or imdb or other website with thousands if not millions of entities.

  6. Santosh (2022-05-09) #

    Totally agree. I use a link shortener like this https://l.mypad.in/y_su

    l => Link (subdomain)
    mypad.in => Domain
    URL => simple one


    I did this for myself actually so that I can quickly go to my fav apps .. but then now use it for all useful links. The service I use comes with neat search functionality to dig up old links.

  7. spike (2022-05-09) #

    yeah that's a nice to have but in reality not always achievable, plus SEO sometimes requires keywording urls (e.g. /domain/files/this-keyword-blah-blah.html)

  8. Nico (2022-05-09) #

    I still add .html because sometimes it's useful to drop a copy of a site on disk.

  9. Paul (2022-05-09) #

    I use OSlash. You can pretty much name your links anything you want. Saves a ton of time and easy to remember since you have entire control on naming the link.

    You can just type in o/sivers in your URL bar and you'll reach the homepage of Derek Sivers.
    P.S: Add OSlash extension to your browser before you type in the shortcut (https://www.oslash.com/get-started)

  10. mlkrsrc (2022-05-09) #

    Great insight, long live PG

  11. Richard (2022-05-12) #

    Your use of short URLs are particularly effective as they are so harmonious with your branding/message as a whole. The consistency with which you speak, write, and communicate here and on email all radiate utter authenticity. It's so refreshing. Seeing your URLs just think makes me think "that is so Derek Sivers" - which is wonderful!

    Keep up the great work
    ☺ What a nice compliment! Thank you. — Derek

  12. Derek Sivers (2022-05-14) #

    Also see this page, of very similar thoughts, but elaborated more:

    https://qntm.org/urls

    (Thanks to D. Bodhan for showing me this today.)

  13. visitor (2022-05-16) #

    I agree with Richard, it does align quite nicely with the style and the overall message of your work.

    Side question since you mentioned NGINX, are you still using OpenBSD for everything?
    If so, why not use its native (and modern) httpd instead of nginx?

    https://man.openbsd.org/httpd.8
    Love OpenBSD and yes, using it for everything. But Nginx has features I like that httpd doesn't yet have. — Derek

  14. Abedi Obasanjo (2022-05-21) #

    This isn't about "branding" or "authenticity". This is just the right thing to do.

    Short URLs benefit everyone, from the visitor to the webmaster. Wherever possible, they should be used. Even if they cause a bit of extra work for the web designer.

    For my website, the only way to get the URL without the ugly ".html" at the end was to call the page an "index" file.

    So I've got several directories that all contain an "index" file. Crazy? Yes. But the clean URLs are worth it.

  15. Leah Nielson (2022-06-20) #

    Re: The Social Media Share button stuff.

    Yeah but most social medias automatically convert your links to a analytics link so that benefit is automatically nullified.

  16. Riddhesh (2022-06-26) #

    Does anyone know what to do if you use GitHub pages?

  17. Vivek Wisdom (2022-07-21) #

    I agree with keeping URL's short and concise.

    We also have to understand that these days lot of people find content using search engines and for them URL's are part of indexing mechanism.

    Keeping it short yet specific to post can be a good idea. Essentially we can remove all the stop words from URL.

    For Ex:

    Original => yoursite.com/blog/2022/05/08/short-urls-why-and-how.html
    New => yoursite.com/short-urls

    or

    Original: site.com/polut
    New: site.com/digital-polution

    Although, I am curious how do you decide what URL to keep? is there a script to automatically suggest that from a title etc.
    I don't care about SEO because it's always changing and I'm thinking very long-term. So I choose a URL that I can remember. I reference my own URLs often when answering emails, so that's what's most important to me. — Derek

  18. Mike (2022-08-03) #

    Thank you for sharing this, Derek. I love this idea. I have a question. Do you add this line of code to each html file you save? Or where does your "http block" reside? Thank you for your help.
    It’s in the config file — nginx.conf — on the server, so only edited once when you first set up your web server. I set it as that once over 14 years ago, and haven’t touched it since. — Derek

  19. Sam (2022-09-21) #

    Love the philosophy of short URLS. The only barrier I've found is communicating them verbally over the phone or in a podcast interview.

    To me "Sivers dot org" is easily remembered by the listener. Fully pronouncing "S-I-V-E dot R-S" feels like it invites errors on the listeners part ("Wait, was it S-I-V dot E-R-S?")

    What approach do others take when verbalizing short urls or using uncommon TLDs?