Welcome Guest, Not a member yet? Register   Sign In
Moving index.php in separate folder by default ?
#1

Hi, All.

You know that the common structure of CodeIgniter now is:
Code:
/ -  Root folder
/application/ - App folder
/system/ - System folder
/index.php - most important index file..

This way always application and system folders are in the site root folder.
I know that there are htaccess restrictions but even this way its not the right way to have them structured.

I want to suggest  - perhaps even from CI 3.0 as its not a real new feature or upgrade..
To create one additional folder and to move inside it the main index.php file as: 

Code:
/ -  Root folder
/application/ - App folder
/system/ - System folder
/new folder(www or web or public or other)..
/new folder/index.php - most important index file.. and website Root

This way only 1 PHP file will be in a public path..

I am always making such structure on CI setup as I don't accept that the base structure is right. That is the reason to suggest this change here..

So what do you think about that ?

Regards
Best VPS Hosting : Digital Ocean
Reply
#2

Look, let them just release 3.0. At least your proposal needs documentation updates, this would take some time.
Reply
#3

I'm sure this is already possible and has been available since 2.x

If you edit index.php, you can change the paths in the following variables.

$system_path = 'system';
$application_folder = 'application';
Reply
#4

There is enough time until session lib is 100% up Smile but I can agree that it will be best not to slow 3.0
Best VPS Hosting : Digital Ocean
Reply
#5

I never tried it, but it looks like you can already do that. From the main CI index.php file :

Code:
/*
*---------------------------------------------------------------
* SYSTEM FOLDER NAME
*---------------------------------------------------------------
*
* This variable must contain the name of your "system" folder.
* Include the path if the folder is not in the same  directory
* as this file.
*
*/
    $system_path = 'system';

Code:
/*
*---------------------------------------------------------------
* APPLICATION FOLDER NAME
*---------------------------------------------------------------
*
* If you want this front controller to use a different "application"
* folder then the default one you can set its name here. The folder
* can also be renamed or relocated anywhere on your server.  If
* you do, use a full server path. For more info please see the user guide:
* http://codeigniter.com/user_guide/general/managing_apps.html
*
* NO TRAILING SLASH!
*
*/
    $application_folder = 'application';
Reply
#6

(11-24-2014, 08:02 AM)includebeer Wrote: I never tried it, but it looks like you can already do that. From the main CI index.php file :

You're absolutely right. You can change those and move your files wherever you need to. You could even have several sites that all reference a single install of CI core (the system folder) if you wanted.

Having ran an open-source project on top of CI for several years now, I can say that making that security measure a default is a bad thing. Many developers don't have the experience to work around some of the other challenges it creates. One of the biggest being the way that cPanel handles primary domains - they must be in the main web folder. To use it in a subfolder (like the public folder mentioned above) requires some .htaccess tricks that many people aren't familiar with.

To keep the framework simple to use for everyone, keeping it with the more "traditional" structure is definitely the best. And cuts down a LOT in support requests. Smile
Reply
#7

Absolutely agree with your points, keep things simple and "traditional", not to overwhelm beginner users (majority).

When beginners become advanced hackers, they eventually know what and where to configure to make their app more "secure".

Anyway, glad that CodeIgniter is being adopted!
Reply




Theme © iAndrew 2016 - Forum software by © MyBB