src/Admin/Infrastructure/Templates/apache_vhost_all.include
<IfModule mod_rewrite.c>
RewriteEngine On
# Redirect all traffic to the main domain (if not in development mode)
RewriteCond %{ENV:APP_ENV} !development
RewriteCond %{HTTP_HOST} !^{{primary_domain_pcre}}$ [NC]
RewriteCond %{REQUEST_URI} !^/\.well\-known
RewriteRule ^ https://{{primary_domain}}%{REQUEST_URI} [L,R=301]
</IfModule>