Personal URL shortener with Netlify Redirects

edit ✏️


Photo by Ozark Drones on Unsplash

I love using URL shorteners to easily share links without hitting character limits, but they loose their meaning. Services like will save my links for me so that I can find them, but I would rather them to be easy to remember. does not roll of the tongue so well.

301 πŸ€Έβ€β™€οΈ

I recently discovered a really cool feature of netlify that I have always looked past, _redirects . It is so simple cool and powerful, every netlify site should do this!

But how πŸ€·β€β™€οΈ

simply add a _redirects file to the root of your your published site with the following format. The trick I found with my gatsby site was that it needed to be in my static directory /static/_redirects , not root. Next you just put space separated links on separate lines. #'s can be used for comments.

# netlify redirects
# from_url to_url

# Short-Blog

/blog/scli         /blog/simple-click/
/blog/cmdt         /blog/cmd-exe-tips/

# splats

/b*             /blog/:splat
/n*             /notes/:splat

# External


πŸ™Œ Share those short links

Now with shorter links we have more space for our content without needing to use a service like that makes our links unreadable.

url shortener