I've got a domain (example.com) pointed to an apache2 webserver.
the root www folder looks like:
www/
site/
app/
test/
The apache config should:
- send all requests to http://www.example.com/ to the 'site' folder.
- send all other subdomain requests to the 'app' folder, while setting the subdomains name as a environment variable.
I am sure that the DNS settings are correct, all urls get resolved to my webserver.
This is what I got in my apache configuration:
<VirtualHost *:80>
<Directory />
Options Indexes FollowSymLinks Includes
AllowOverride All
Order deny,allow
Allow from all
Require all granted
</Directory>
ServerName www.example.be
ServerAlias www.example.be
DocumentRoot /var/www/site
ErrorLog ${APACHE_LOG_DIR}/site/error.log
CustomLog ${APACHE_LOG_DIR}/site/access.log combined
</VirtualHost>
<VirtualHost *:80>
<Directory />
Options Indexes FollowSymLinks Includes
AllowOverride All
Order deny,allow
Allow from all
Require all granted
</Directory>
ServerName example.be
ServerAlias *.example.be
VirtualDocumentRoot /var/www/app/production/source
SetEnv VAR_NAME %1
ErrorLog ${APACHE_LOG_DIR}/site/error.log
CustomLog ${APACHE_LOG_DIR}/site/access.log combined
</VirtualHost>
The first VirtualHost, the www rewrite to the site folder works as it should be.
The second one does a correct rewrite, but I can't put the subdomain in the environment variable.
Can anyone help me with this last step? I'm not really an apache expert...
Thanx!