Skip to main content
Url shortening service using a static website on Netlify

Url shortening service using a static website on Netlify

This is a quick and practical proof of concept of a “free” link redirection service, hosted on Netlify. I am using one of my domains to redirect to various URLs, to my own projects. The setup is simple and can be done in a matter of minutes.

Step 1: add your redirects in quicklinks/_redirects. The accepted format is documented at Netlify. For more complicated cases add your rules to netlify.toml.

For example:

1# general links

Step 2: create a netlify.toml that defines the folder quicklinks to be deployed as live site.

2  publish = 'quicklinks/'
2  publish: quicklinks/
2   "build": {
3      "publish": "quicklinks/"
4   }

Step 3: add your repository to your Netlify organisation and deploy.

Step 4: add a custom domain or make your Netlify sub-domain look nice by renaming it to something other than under “Site Configuration” > “Change site name”.

Then use your redirects.

I connected my tool-domain to a quick setup of URLs for my projects and you can test it by any arbitrary redirection from this setup file (I admit it’s not widely used yet). For example sends you right to my GoHugo module repository and sends you to the landing page for my hooks module.

The initial advantage of having shorter URLs is topped by your ability to change endpoints by just re-deploying a new version of your site instead of having to go through all places where you mentioned this URL. This is a great way to have a “free” URL shortening service for your own projects.

Back to top
Back Forward