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.