When developing with CakePHP, we can setup Apache to automatically redirect a domain to a specific CakePHP application.
We can set computer’s aliases using hosts file. Apache will automatically map aliases to different DocumentRoot:
app1.mybox.com -> /var/www/cakephp/app1.mybox.com/webroot app2.somewhere.com -> /var/www/cakephp/app2.somewhere.com/webroot
Step 1: Enable the mod_vhost_alias:
$ sudo a2enmod vhost_aliasStep 2: Replace the DocumentRoot statement in default virtualhost configuration file with two lines:
UseCanonicalName Off VirtualDocumentRoot /var/www/cakephp/%0/webroot

