Wildcard on DocumentRoot for virtualhost
Set rewrite rule grab the sub.domain and redirect to /sub/requestedFile
RewriteCond %{HTTP_HOST} ^([a-zA-Z0-9-]+)\.example.com$
RewriteRule ^(.+) /%1/$1 [L,QSA]
Or set VirtualDocumentRoot with %-1 representing the sub domain.
<VirtualHost *:80>
VirtualDocumentRoot /var/www/%-1
ServerName sumdomains.example.com
ServerAlias *.example.com
</VirtualHost>