7

Short URLs: why and how

 2 years ago
source link: https://sive.rs/su
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Short URLs: why and how

2022-05-08

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

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

Short URLs matter for a few reasons:

  • You can remember them. You can avoid the search engine step. No need to search when you already know the answer. Which means…
  • You can tell someone. You can even say it out loud! Whether answering an email or talking to someone on the phone, I can say, “Go to sive.rs/ff for my talk about the first follower.” or “My newest book is at sive.rs/h.” I do this often, so having memorable URLs saves me a lot of searching.
  • They look nicer. They’re aesthetic. They show care. We should put something of beauty into the world, instead of creating digital pollution.
  • They remove the middle-man. With long URLs, people use those ugly social share buttons that promote (and further entrench) harmful social media sites, and add visual clutter to your site. Short URLs encourage people to copy and paste the URL directly, which lets them share it anywhere, instead of only the sites for which you have a share button.
  • They’re enough. Using 36 characters, 26 letters (a-z) and 10 numbers (0-9): 2-letter URLs give you 1296 (36²) unique combinations. 3-letter URLs give you 46,656 (36³) unique combinations. 4-letter URLs give you 1,679,616 (36⁴) unique combinations. You don’t need more than that. Long URLs are overkill.

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

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

default_type text/html;

That’s it! That will serve any file without an extension as HTML.

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

© 2022 Derek Sivers.

Copy & share: sive.rs/su

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.

Your thoughts?
Please leave a reply:

Your Name Your Email   (private for my eyes only) Comment

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK