user1765862
user1765862

Reputation: 14145

codeigniter folder structure on webserver

I want to upload code igniter folder to remote server. Should I upload codeigniter root folder to my public_html folder so I got following structure

public_html/
            codeigniter/
                       application/
                       system/
                       ....

or should I upload application system ... directly to my public_html, and if I upload under codeigniter folder can I point somewhere in config to my codeigniter library in a way that my links remains without /codeigniter/

Upvotes: 6

Views: 4593

Answers (4)

mmrs151
mmrs151

Reputation: 4072

Form the user guide

For the best security, both the system and any application folders should be placed above web root so that they are not directly accessible via a browser.

So my setup is to have a custom public directory in the codeigniter codebase and have the index.php inside it.

And copy the .htaccess and index.html from either system or application folder to the codebase to forbid access to the base.

enter image description here

Upvotes: 3

BMN
BMN

Reputation: 8508

It will depend on the apache configuration on your server.

From my POV, it is better to have a structure like :

public_html/
codeigniter/
    application/
    system/
    [...]/

Then, make your apache configuration point to this folder with something like :

<VirtualHost *:80>
    DocumentRoot "path_to_the_folder/codeigniter"
    ServerName yourDomain.loc
    ServerAlias www.yourDomain.loc
    <Directory path_to_the_folder/codeigniter/ >
        #Your options
    </Directory>
</VirtualHost>

and your /etc/hosts file look like :

127.0.0.1    yourDomain.loc
127.0.0.1    www.yourDomain.loc

Upvotes: 2

Steven Glasser
Steven Glasser

Reputation: 77

You would typically upload everything under /codeigniter. So you would have a directory structure like:

- public_html
  - images
  - js
  - system
    - application
    - other codeigniter folders

Upvotes: -2

egig
egig

Reputation: 4430

it's better to do like:

application/
system/
public_html/
    index.php

for security reason, put your application and system folder outside your public_html

Upvotes: 10

Related Questions