CodeIgniter Setup
CodeIgniter is a small and fast PHP framework. Not all of these steps are necessary to use the framework, but they result in a more secure setup where none of the framework files are ever web accessible.
- Download the
.zip - Create a
public/directory at the same level as thesystem/directory containing asset directories:mkdir public public/images public/javascripts public/stylesheets - Move the
index.phpfile into thepublic/directory:mv index.php public - Edit the
index.phpfile to reflect it’s new location::%s/$system_folder = "system";/$system_folder = "..\/system";/ - Inside of
system/application/config/config.php:- Set the
'base_url'to your sites URL - Clear the
'index_page'config (set it to the empty string) 'enable_query_strings'if necessary- Adjust the
'log_threshold' - Choose a unique
'encryption_key' - Turn
'sess_encrypt_cookie'on - At the end of
config.phpadd:
// optionally load (and potentially override) additional config values if (file_exists('../system/application/config/config.local.php')) { include('config.local.php'); }
- Set the
- Create (and promptly SVN ignore, if applicable) a
config.local.phpfile. The file will usually only contain overrides for ‘base_url’, ‘index_page’, ‘log_threshold’, and ‘log_path’. - Fill out the
database.phpconfig file as necessary, potentially with a companiondatabase.local.phpfile as well. - If you wish to remove the
index.phpfrom you URLs, create a.htaccessfile like so:
RewriteEngine On RewriteCond $1 !^(index\.php|images|stylesheets|javascripts|favicon\.ico|robots\.txt) RewriteRule ^(.*)$ /fresh/index.php/$1 [L]
- Point your document root to the new
public/directory and you’re off!