Or on a sub-domain. Let’s say you have an existing website on your Godaddy hosting plan (example.com for example) and you want to add a sub-domain (temp.example.com). This is what I have done, and I think these instructions might apply for any additional domain you host on your account, but I have not tested that out yet.
First thing, my hosting is through Godaddy. They’re much maligned but one thing I will say in their defense, you can always get someone on the phone. I’m using the Grid Deluxe Linux hosting, I called them up and got confirmation that these servers run Apache 2.2. Legacy plans hosted though GoDaddy may or may not run this exact Apache version.
When you create the temp.example.com sub-domain it will create a folder in your ~/html folder, and the default name will be the same as the subdomain. In my case, the folder created was ~/html/temp.
My main site is a Joomla installation which is using mod_rewrite to do search engine friendly Urls.
The CakePHP site is inside of my ~/html/temp folder. The key to this setup was a fairly simple adjustment to the .htaccess files, using RewriteBase. Here are what my .htaccess files look like.
First, ~/html/temp/.htaccess
RewriteEngine on
RewriteBase /
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
This is what ~/html/temp/app/.htaccess looks like
RewriteEngine on
RewriteBase /app/
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
Finally here is ~/html/temp/app/webroot/.htaccess
RewriteEngine On
RewriteBase /app/webroot/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
Hope this helps.
I’ve looked at a lot of different articles about these issues and did not find one that was 100% satisfactory. I’ll still point to them in case something there covers an aspect that I have not.
CakePHP Console on Godaddy »« A really nice snippet