Chris Wiegman

Creating a Free, Personal Shortlink Service with Netlify

For all their shortcomings, shortlinks still have their uses. In my case I’ve had a shortlink domain that, for years, I’ve used with everything from my resume (, my presentation slides and so many other little tasks where the main URL either changes over time or needs to be shared in the easiest way possible.

To run my shortlinks I used YOURLS for years until I moved it all into WordPress about 3 years ago. Today that WordPress site is no more and all of them run off a free Netlify setup that is both effective and incredibly simple.

Why Netlify?

First, it’s free. I originally moved to WordPress to avoid running a VPS for YOURLS as I could get much cheaper WordPress hosting than maintaining my YOURLS instance anywhere, even on a cheap $5 DigitalOcean droplet. While not a big expense, I don’t keep a whole lot of shortlinks to start with so even the modest expense just didn’t make a lot of sense.

Second, I don’t need stats for these links and they are, in essence, just redirects. The added processing required to run either WordPress or YOURLS, which are both PHP apps with a full database and all the associated resources behind them, just didn’t make sense. It might not be much but computing power matters and is, when taken together, a huge contributor to the climate crisis we now find ourselves in. As I can still achieve what I need without that overhead, it was a no-brainer to switch.

Finally, as I said before I don’t have many links and I don’t update what I do have very often. This means a full UI is overkill and a simple text file makes it all much easier for me to operate. I’m no longer maintaining any apps, plugins, servers or anything else. If I want to change something I just update a single text file, push it to GitHub, and I’m done.

Running a shortlink service on Netlify

Step 1: Register a domain for your shortlinks

This one should be pretty self-explanatory. If you’re going to use a shortlink service you need a domain to run it on. I highly recommend for this but you can register it anywhere.

Step 2: Setup a repository and create your shortlinks

Next, head on over to GitHub and create a repository for your shortlink site. You can find mine at Once you have your repo you’ll add a single _redirects file to it. You’ll populate this file with your shortlinks with the format:

/<shortlink> <destination>

Here’s my _redirects file (note they’re all public links, don’t add passwords or anything else sensitive to yours)

/wowp0721 /wproc0521 /hiroy /talks /hetzner /masto /gpg /resume /nextdns /duolingo /dnsmadeeasy /digitalocean /code /*
Code language: PHP (php)

Finally, note the “/*” on the last redirect. This is a catch-all that sends any 404s for the domain to my own homepage. You can handle this anyway you want or leave it off entirely but it’s just one handy, yet simple, option for handling any attempts to retrieve a link that doesn’t exist.

Step 3: Create the Netlify site

Finally, you’ll want to head over to Netlify and create your new site. Connect it to your GitHub repository and follow the directions to make sure your domain is setup right and, that’s it. Any shortlink you give out will automatically redirect to the location you need it to.

This simple, but effective, setup will make it easy to share links with friends or associates that make getting to important URLs easy.