Hosting CakePHP 2.x to a Free web-hosting site

I got a lot of trouble web hosting my CakePHP applications to a free hosting site. After an hour of searching and tweaking some files, most of it are those .htaccess that you can find in the main folders, I definitely got it to work.

Hosting CakePHP is simple! Just follow these five steps and you’re up any moment.

First step: copy your project folder to your desktop

Copy your project folder to your desktop (or anywhere you like). We will do this to avoid ruining your original files in case something unexpected happens.

Second step:  copy your  app/webroot to the root folder

Copy your  app/webroot to the root folder. Rename “webroot” folder to “public_html”.

Although this is not necessary, I think this will make it simpler and understandable especially when modifying those .htaccess files.

Third step:  modifying  .htaccess

We will be modifying those .htaccess files that can be found in the root, public_html and app directories.

The first .htaccess you need to modify is /.htaccess and use the code below

 The second .htaccess you need to modify is app/.htaccess and use the code below
 The third and last .htaccess you need to modify is public_html/.htaccess and use the code below
What happens here is that you need to add RewriteBase / in order to set the current directory to the root folder and assign those resources to public_html that is the previous webroot.

Fourth step: modify public_html/index.php

We will modify public_html/index.php. Change the line to something like below.

Last step: Upload

Let upload your application using FTP tools, I use FileZilla as my FTP tool.
Now you are good to go!
Take Note: You only have to upload the files and folder inside your main project folder.

Sharing is caring!