Using Apache. I have a txt file of domains that I want to use for mapping directory aliases. But I can't figure it out.
The txt-file looks like this:
example.com folder1
anotherexample.com folder2
subdomain.example.com folder3
...500 domains...
A request to example.com/data/
should resolve /var/private/folder1/
.
I have tried the following in my virtualhost directive:
<VirtualHost *:80>
ServerName www.site.com
ServerAlias *.site.com
DocumentRoot "/var/www/project"
RewriteEngine On
RewriteMap ref "txt:/var/path/to/domains.map"
RewriteCond ${ref:%{HTTP_HOST}} ^.+$
RewriteRule ^/data "/var/private/${ref:%{HTTP_HOST}}" [L]
</VirtualHost>