tags:

views:

1652

answers:

2

This is one thing I haven't been able to do with Cake. I have tried it a few times and couldn't figure it out. I am on hostgator and it could help if someone could point how they've been setting it up (Advanced installation).

Edit

I have read the documentation and I get errors. I guess I haven't been reading it all too well.

Edit I just found this post. http://www.ad7six.com/MiBlog/ProductionSetup

+4  A: 

My best shot at your problem is this:

You will probably have a user directory (probably /home/user) containing a /public_html directory or /htdocs or even a /html where you are supposed to put your files in.

In my personal experience you should descompact your cake/project files on this directory (/public_html from now) like:

/public_html
/public_html/app
/public_html/cake
/public_html/libs

and you will end with your website root in this structure, located at:

/public_html/app/webroot

Most Hosting sites allow you to put a .htaccess files on the root dir:

/.htaccess

You will need to creat this .htaccess file with following content:

DocumentRoot /home/user/public_html/app/webroot

Just remember that the /home/user/public_html can be anything, but you can probably figure it easily, via shell or calling the host support.

G'luck!

Fernando Barrocal
this is wrong.You can't add DocumentRoot directive in .htaccess.See documentation http://httpd.apache.org/docs/2.0/mod/core.html#documentroot
avastreg
+2  A: 

This is exactly what I did on dreamhost.com

I made a domain like usual, lets call it cake.example.com

in the root directory I had the cake directory which I simlinked as just 'cake' So it was /home/myusername/cake which contains the cake unzipped.

in my homedirectory I edited the file .bash_profile and added this line at the bottom of the file.

export PATH=$PATH:/home/myusername/cake/cake/console

Then you need to logout and log in again or source the .bash_profile

Now you can bake.

After you bake your app inside cake.example.com you have to edit the file /home/myusername/cake.example.com/webroot/index.php

if (!defined('CAKE_CORE_INCLUDE_PATH')) {
         //define ('CAKE_CORE_INCLUDE_PATH', 'FULL PATH TO DIRECTORY WHERE CAKE CORE IS INSTALLED. DO NOT ADD A TRAILING DIRECTORY SEPARATOR');
         //You should also use the DS define to separate your directories
        define('CAKE_CORE_INCLUDE_PATH', '/home/myusername/cake');
}

You see in the last line, you point it to the cake source directory. This way you can actually have many cake apps all using the same cake app directory.

Kind of sweet right ?

But that is not all. Inside the /home/myusername/cake.example.com

You need to create a .htaccess file and put this inside it.

<IfModule mod_rewrite.c>
    RewriteEngine on
        rewriteRule ^(.*) http://cake.example.com/$1 [L]
 RewriteRule ^.* http://cake.example.com%1 [R=permanent,L]
 </IfModule>

And now you are on your way to cake bliss.

Trausti Thor Johannsson