Build your own URL shortener service with Netlify
RACE.TW uses GitHub and Netlify as a URL shortener for personal use. The method is to use Netlify's _redirects
file to do the redirection, please refer to “Redirects and rewrites - Netlify Docs” for more details.
Procedure permalink
- Buy a domain name, the shorter name is better.
- Create a new repository on GitHub and add a
_redirects
file with the following content:
# Redirect with a 301
/FH4 https://store.steampowered.com/app/1293830/Forza_Horizon_4/
- Go to Netlify to create a new website, connect to the GitHub repository, set the DNS binding domain name, and wait until the website is automatically built and deployed.
Generally, a single _redirects
file is all that's needed for a site to be able to redirect, but you can refer to “netlify-shortener” to build it.
So for this example, when you go to https://race.tw/FH4, it redirects you to https://store.steampowered.com/app/1293830/Forza_Horizon_4/.