Setting up Mastodon for a subdomain when the main server has Apache

Hi, I am in the process of configuring Mastodon in a subdomain. I am following the guide.

.env.production has been already configured:

Proof that it works:

However, I’m stuck in the last step: Configuring The documentation says:

With nginx, it would be as simple as adding:

location = /.well-known/host-meta {
return 301$request_uri;

However, the (Debian) server running uses Apache, and this is where I get lost. What configuration file do I need to edit (there are several) and what should I add?

After a bit of trial and error, I think I have found it:

In 000-default-le-ssl.conf add

Redirect permanent /.well-known/host-meta