DEV Community

Cover image for A Custom Domain in 4 lines of code
Tom Larkworthy
Tom Larkworthy

Posted on

A Custom Domain in 4 lines of code

When clients ask me to add a vanity domain, I usually use their Cloud provider, which is ok but tends to be a little fiddly and not particularly cheap.

For a private project, I wanted a custom domain ASAP, for free. I think I found my simplest setup using Netlify rewrite rules. The beauty of Netlify is that it can sync with a git repository and so the only native tool you need is git.

So all I needed to do was commit the following netlify.toml to a Github and then deploy my custom domain from Github.

[[redirects]]
  status = 200
  from = "*"
  to = "https://webcode.run/observablehq.com/@tomlarkworthy/tarot-webserver:splat"
Enter fullscreen mode Exit fullscreen mode

Setting up Netlify to handle a custom domain is one of the easiest processes, even if you register the domain elsewhere.

This 1 hour of work the first time you do it and less than 15 minutes of work going forward. Custom domains with SSL could not be easier.

Cover Photo by mk. s on Unsplash

Top comments (0)