[Apache] Combining Static & Dynamic VirtualHosts.
I've got a few domains pointing to my VPS. The first few are in separate locations, with a normal virtualhost config it works without a hitch. But I'm starting to host a few domains out of a single directory.
The first domains are configured as followed :
example.com loads /srv/http/example.com/
example2.com loads /srv/ruby/example2.com/
example3.com loads /srv/http/example3.com/
Now I have a bunch of other domains which are loaded from
/srv/php/lum/domains/*
Each domain has it's own subfolder there. I've been trying to use the virtualdocumentroot stuff in Apache to let the domains that I haven't declared in httpd-vhost.conf to load there, I've tried via .htaccess in the default domain documentroot as followed :
RewriteEngine On
RewriteMap lowercase int:tolower
RewriteCond !%{HTTP_HOST} ^defaultdomain\.com [OR]
RewriteCond !%{HTTP_HOST} ^www\.defaultdomain\.com
RewriteRule ^/(.*)$ /srv/php/lum/domains/${lowercase:%{SERVER_NAME}}/$1
Only this gives me an error on RewriteMap, so I moved it to extra/httpd-vhosts.conf
<virtualhost *:80="">DocumentRoot "/srv/php/lum/"
ServerName defaultdomain.com
ServerAlias www.defaultdomain.com
ErrorLog /srv/php/lum/logs/defaultdomain.com
RewriteEngine On
RewriteMap lowercase int:tolower
RewriteCond !%{HTTP_HOST} ^defaultdomain\.com [OR]
RewriteCond !%{HTTP_HOST} ^www\.defaultdomain\.com
RewriteRule ^/(.*)$ /srv/php/lum/domains/${lowercase:%{SERVER_NAME}}/$1</virtualhost>
With the other static virtualhosts configured below that.
Then when I go to an domain I haven't staticly configured it still shows /srv/php/lum/* instead of /srv/php/lum/domains/thedomain.com/*
Anything else I could try or is it impossible to combine? Would save me some time setting up another block of Vhost for each new domain.
Thanks alot