Short URLs Why and How

Tech blog: 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:

  • 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 (a-z and 0-9):
    2-character URLs give you 1296 (36?) unique combinations.
    3-character URLs give you 46,656 (36?) unique combinations.
    4-character URLs give you 1,679,616 (36?) unique combinations.
    You don't need more than that.
  • That doesn't mean the shorter the better. If you can remember "/short" easier than "/su", then that's a better choice.

    How?

    Here's how I do it: Save your HTML file as the URL name, 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 your files without extensions 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. (C) 2022 Derek Sivers.

    Komentar

    Postingan populer dari blog ini

    Madewell Concrete Jobs

    Fresno Veterinary

    Enzyme Therapy Wiki