Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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/

like image 816
user1765862 Avatar asked May 20 '13 12:05

user1765862


3 Answers

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

like image 120
egig Avatar answered Sep 25 '22 19:09

egig


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

like image 25
mmrs151 Avatar answered Sep 24 '22 19:09

mmrs151


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
like image 23
B F Avatar answered Sep 23 '22 19:09

B F