Here’s a little note on getting a cakephp app working in your public_html directory. In order to get the mod_rewrite configuration working, add a RewriteBase rule to the .htaccess files in the cakephp source. If your app is located in /home/me/public_html/cakesite/ and the URL to the site is http://host/~me/cakesite you’ll need to change the following .htaccess files:
/home/me/public_html/cakesite/.htaccess
/home/me/public_html/cakesite/app/webroot/.htaccess
Add the following line to these files, just below the line stating “RewriteEnginge On”:
RewriteBase /~me/cakesite/
For example, the first .htaccess file will look like:
<ifModule mod_rewrite.c> RewriteEngine on RewriteBase /~me/cakesite/ RewriteRule ^$ app/webroot/ [L] RewriteRule (.*) app/webroot/$1 [L] </ifModule>
Bonus notes with instructions for Debian/Ubuntu systems
You should have mod_rewrite enabled:
$ sudo a2enmod rewrite
$ sudo /etc/init.d/apache2 force-reload
To make sure the use of .htaccess files is actually allowed. In the Directory section of your apache configuration, there should be a line like:
AllowOverride FileInfo
Also, be sure to force-reload Apache after making this change.
Thanks for the tip — I’m glad Google brought me here! Just one extra thing: in the list of files to edit, shouldn’t there also be the following (note the …/app/…)?
/home/me/public_html/cakesite/app/.htaccess
I’ve tested with the modification in just the two mentioned .htaccess files. I’m not completely sure weather it’s needed, but it does work without modifying the .htaccess file in /app/.