Orangemn6's blog


Orangemn6's blog


Making a Simple Url Shortner With Netlify

Orangemn6's photo
·Feb 9, 2021·

3 min read


So, I made a new URL shortener,, and if you click that link it will redirect right back to this site. Now if you go to, it redirects to Jacob MC. I am going to show you how to do this

Setting up netlify

So you have 2 options here:

  1. Set up your own repo
  2. Clone mine

I am gonna show you how to do number 1

So first, make a github repo. I called mine because that is the shortener. Clone that repo locally, you know the drill. cd into it. Now make a package.json with this inside:

  "baseUrl": "",
  "private": true,
  "scripts": {
    "shorten": "netlify-shortener"
  "author": "orangemn6",
  "devDependencies": {
    "netlify-shortener": "^1.0.1"

So what this does is it tells netlify that it needs the netlify-shortener package. Now we start the shortener part.


So, make a file called _redirects, and inside of it put a structure like this:



What this does is it tells netlify, here are my redirects. Now, git add, git commit, and git push.

Adding to netlify

Now, make a new netlify site and connect the github repo to it (Note: this will also work with gitlab). Now, add your domain into netlify, setup Netlify DNS, and wait a minute. Now go to and see your url shortener work!


Well, now you know how to make a URL shortener with netlify. If you have any questions, contact me or comment below!

Share this