Create a wildcard subdomain for your domain, and add a virtualhost for it, if there is not a virtual host without ServerName
:
<VirtualHost *:80>
DocumentRoot /path/to/an/example/documentroot
#make sure mod_rewrite is enabled
RewriteEngine On
RewriteCond %{HTTP_HOST} !^example.org$ [NC]
RewriteRule ^ https://example.org%{REQUEST_URI} [L,R]
</VirtualHost>
This will forward all subdomains without a separate VirtualHost.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…