Mastodon Redirect

• Site name: multigrade.netlify.app
• Domain https://reh.at

I have setup a mastodon server on a subdomain on https://reh.at and would like for the root domain to redirect requests not found on the routes. The documentation on mastodon mentions nginx redirects, specifically through the WEB_DOMAIN environment variable.

Question: How would I go about setting up a redirect on my netlify hosted website? The documentation gives the following example:

location /.well-known/webfinger {
  return 301 https://mastodon.example.com$request_uri;
}

Side note, the root website is open-source: GitHub - rehatkathuria/reh.at

Hey kth,

To create a redirect, you can put it in your netlify.toml file or a _redirects file and it will automatically be detected upon deploy. You would need to use splats as a catchall here.

To format this redirect for a _redirects file, it would look like this:

/.well-known/webfinger/* https://mastodon.example.com/:splat 301

You can learn more here: Redirect options | Netlify Docs