Reputation: 2458
All my vhost are the same way and I dont want to create for every project a new one so I thought there is maybe a way to match the project_name
environment
based on the domain which call the webserver.
My current Vhost:
<VirtualHost *:80>
DocumentRoot "/Users/l91/Development/<project_name>/web"
ServerName <project_name>.<environment>
<Directory "/Users/l91/Development/<project_name>/web">
Options Indexes FollowSymlinks
SetEnv SYMFONY_ENV <environment>
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Upvotes: 0
Views: 88
Reputation: 2458
Did get it to work with this configuration:
NameVirtualHost *:80
<Directory "/Users/l91/Development/Websites">
Options Indexes FollowSymlinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
UseCanonicalName Off
VirtualDocumentRoot /Users/l91/Development/Websites/%0/web
SetEnvIf X-SYMFONY_ENV "^prod$" SYMFONY_ENV=prod
SetEnvIf X-SYMFONY_ENV "^stage$" SYMFONY_ENV=stage
SetEnvIf SYMFONY_ENV "^$" SYMFONY_ENV=dev
and use of the following plugin to change ENVs by setting a header: https://chrome.google.com/webstore/detail/modheader/idgpnmonknjnojddfkpgkljpfnnfcklj
Upvotes: 1
Reputation: 220
It sounds more like you're looking for aliases or rewrites, rather than a virtual host. You can likely use rewrite rules to find them dynamically.
Upvotes: 1