# Apache Virtual Alias
Apache Virtual Alias lets you map a subdomain to a directory within a Virtual Host entry.
This lets you create dynamic sites just from directories without needing to create a virtual host entry each time.
### Enable Mod
```shell
sudo a2enmod vhost_alias
```
### VirtualHost Example
```
ServerAlias *.acme.com
VirtualDocumentRoot /home/user/sites/%1
Options +Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
```
Once this is setup restart apache and all subdomains will map to relevant document roots.
Its also possible to map more than one wildcard to a subdomain, which matches in order of subdomain
```
ServerAlias *.*.acme.com
VirtualDocumentRoot /home/user/sites/%2/%1
Options +Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
```