6

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/

4
  • If you do it your way, you will access the website as www.yoururl.com/codeigniter Commented May 20, 2013 at 12:15
  • @RaduCojocaru it will depend on the apache configuration Commented May 20, 2013 at 12:16
  • better to upload it to the public_html/ directly Commented May 20, 2013 at 12:17
  • True, I was thinking of the default configuration. Commented May 20, 2013 at 12:17

4 Answers 4

9

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

Sign up to request clarification or add additional context in comments.

3 Comments

you say that I should put ci folder content outside of public_html? Where in config should I point to ci library?
In index.php change the path to the system & application folder to be one level up from public_html/index.php.
You can access your CI library as usual, what you need is just set right path to your system and app folder like @stefandoorn said.
3

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

Comments

2

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

Comments

-2

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

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

1 Comment

Preferably put the system & application folder outside public_html.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.