I got the documentroot set up like this: var/www/html
What I'm trying to do is:
cms.domain.com --> var/www/html/cms
domain.com --> var/www/html/cms/sites/site1
I'm trying to accomplish this by using virtualhosts. The problem is I can't set a VirtualDocumentRoot for each (sub)domain because the sites use a bunch of scripts and configs, located in var/www/html/includes which are supposed to stay non public, and the apps call these with $_SERVER["document_root"].
What I've tried is this:
<VirtualHost *:80>
ServerName domain.com
ServerAlias *.domain.com
ServerAlias www.domain.com
AliasMatch ^(.*)$ /cms/sites/site1/
DocumentRoot /var/www/html
<Directory /var/www/html>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<IfModule mod_dir.c>
DirectoryIndex index.php index.pl index.cgi index.html index.xhtml index.htm
</IfModule>
</VirtualHost>
and for the subdomain:
<VirtualHost *:80>
ServerName cms.domain.com
ServerAlias *.cms.domain.com
AliasMatch ^(.*)$ /cms/
DocumentRoot /var/www/html
<Directory /var/www/html>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<IfModule mod_dir.c>
DirectoryIndex index.php index.pl index.cgi index.html index.xhtml index.htm
</IfModule>
</VirtualHost>
Doesn't work. I guess what I'm actually looking for is something to append the path after documentroot while keeping documentroot how it is.