If you are to setup CakePHP in a virtual hosting environment, we need to ensure that the DocumentRoot is setup correctly. Based on the experience I have had I thought to list down the virtual host setting and cakephp .htaccess setting files.
root@myserver:/etc/apache2/conf.d# cat vhosts.conf NameVirtualHost 192.168.1.100:80
<VirtualHost 192.168.1.100:80> ServerName cakeapp DocumentRoot /var/www/cakeapp </VirtualHost>
(Note that there is no ending forward slash after /var/www/cakeapp. If there had been one, it might cause a problem if the /var/www/cakeapp/app/config/routes.php is not configured correctly indicating a never ending loop in resolving domain name)
root@myserver:/etc/apache2/conf.d# cat /var/www/cakeapp/.htaccess <IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^$ app/webroot/ [L] RewriteRule (.*) app/webroot/$1 [L] </IfModule>