Welcome Guest, Not a member yet? Register   Sign In
move config out of system folder?
#1

[eluser]CI TaMeR[/eluser]
Hi,

I have placed the CodeIgniter system folder within a public folder and have enabled $_GET in CodeIgniter so that I can use AJAX from within CodeIgniter.

For safety I would like to move the config folder out of the public folder.
How would I go about doing that?

Thanks
#2

[eluser]Glen Swinfield[/eluser]
Quote:For safety I would like to move the config folder out of the public folder.
I'd agree that is a good idea!

Probably extend the Config.php class/lib with MY_Config and change the path default is:

Code:
//this is not the most recent version of CI, so it may be a little different now
include(APPPATH.'config/'.$file.EXT);

Or you could just edit libraries/Config.php and maybe create a new constant MYCONFIGPATH and use that in place of APPPATH.
#3

[eluser]thurting[/eluser]
For production I usually move both the system and application folders above the web root. This is really the best choice security wise. I also remove the application folder from the system folder so I can easily update CI without affecting the app. The only files I keep public are the bootstrap and js/css/img/etc. My dir structure is roughly:

Code:
- CI
  - system
  - application
- www
  - index.php
  - other public assets

The only variables that need to be changed are $system_folder and $application_folder in the bootstrap. Using the structure above, something like $system_folder="../CI/system" works. Very easy to do. Keeps private files private and makes for easy updates to the framework. It also makes running multiple apps off of the same CI install easy. Just pop in another application folder and make sure you properly name everything and edit the bootstraps and config files where necessary ($config['base_url']).
#4

[eluser]lkagan[/eluser]
Fantastic solution. Thanks for the post!




Theme © iAndrew 2016 - Forum software by © MyBB