Mastodon redirect with your domain in Netlify
Because Mastodon is federated, the account name includes both the name and the server. For example, my account is in mastodon.world, so you can find me as @hamatti@mastodon.world compared to just @hamatti as it would in a single-system social network.
It does have one downside though: there are so many servers and many named quite similarly that it can be easy to forget someone's handle. For example, there's mastodon.world and mastodon.social or in the Finnish network, there's mastodontti.fi and mastodo.fi.
You could setup your own server on your own domain but managing a server is not always a good option and you might not want the maintenance burden or potential legal considerations to your shoulders just to have an easier-to-remember handle.
I'm using Netlify to host this website, hamatti.org, and I made some magic happen and now if you copy @hamatti@hamatti.org into your Mastodon instance search window, it will find me from @hamatti@mastodon.world:
Not only is it easier to remember but it also looks hella cool and you earn that sweet geek street cred when you tell your handle to a friend in a conference.
How to do it?
Netlify has support for a _redirects
file where you can define redirect rules. To make the Mastodon thing work, you only need to add this one rule:
/.well-known/webfinger/* https://{your_mastodon_domain}/.well-known/ webfinger?resource=acct:{your_account}@{your_mastodon_domain} 301
If you're using (or anticipating to use) the ./well-known/webfinger/
for something else too, you probably want to be more specific but I don't know what it's used for so I'll cross that bridge if I get there.
Add that line to the file, replace the curly-braced things with your details, deploy to Netlify and boom, you're cool.
What if I'm not using Netlify?
The redirect rule is still the same but you need to figure out how to do it with your service provider or server software. Just google "[your provider] redirect rules".
Be careful of what you redirect
Jan 25th update: I learned today from this toot:
PSA: If you're setting up a Mastodon account alias on your own domain, don't add a/.well-known/nodeinfo
resource.
A NodeInfo that points/redirects to another Mastodon server (e.g. mastodon.social) says that your domain is a full Mastodon server, with all the details of mastodon.social - e.g. its user counts. That's bad!
There's no need to have a NodeInfo resource on your domain to set up an alias - you only need the WebFinger resource.