We recently had to set up a development site for an existing CodeIgniter site, and we wanted to do this effortless. Ideal would obviously be to have a separate virtual domain or a separate box but hey, “ideal” isn’t always ideal, heh.

By applying the same principle as in our previous WordPress article on the same topic, this is done in well under 5 minutes. Upload the same /dev folder as in the WordPress case, and make the following modification in the main CodeIgniter index.php file.

Change this:

$system_folder = "system";

to:

if(isset($_COOKIE["dev"])){
	$system_folder = "sysdev";
}else{
	$system_folder = "system";
}

Then copy the /system directory to /sysdev – and that will be your new development docroot. Once you’re ready to release your next version, either copy each file from /sysdev to /system – or simply change the name of /system to /system-OLD and /sysdev to /system.