ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Hiding Core System Folders in root of server instead of www folder?????

August 06, 2007 8:23pm

Subscribe [6]
  • #1 / Aug 06, 2007 8:23pm

    ceej

    9 posts

    Hi there,

    is it possible using htaccess or some other way to hide all the core system folders in the root of the server instead of the www folder. So all you have to have in the www part is your application folder so you could use the codeigniter on multiple sites without having to keep re-uploading the core files?

    Many thanks

  • #2 / Aug 06, 2007 8:45pm

    coolfactor

    354 posts

    That’s the *only* way I build my sites. I rarely put my /system/ or /application/ folders inside the webroot. Just move your folders and adjust the paths inside index.php. That should do it.

  • #3 / Aug 06, 2007 8:47pm

    coolfactor

    354 posts

    Also, if you’re on a Linux (ie. Ubuntu) or UNIX-based operating system (ie. Mac OS X), then symlinks (not aliases or shortcuts) are invaluable in a web-development environment. I use them extensively to avoid duplicate files all over my file system.

  • #4 / Aug 06, 2007 9:04pm

    ceej

    9 posts

    Thank you for that 😊

    So what do you normally put in your www folder?

  • #5 / Aug 06, 2007 9:25pm

    Michael Wales

    2070 posts

    Everything within your application folder (as long as your index.php is correctly configured). You can also place your assets (images, css, javascript) in the root folder if you would like.

  • #6 / Aug 06, 2007 9:31pm

    coolfactor

    354 posts

    My setup looks like this:

    /application/
        /config/
        /controllers/
        ...
        /views/
    /CodeIgniter-1.5.4/
        /system/
    /webroot/
        index.php

    As long as the $application_folder and $system_folder variables are set correctly in index.php, you can put your folders anywhere you want.

    I keep the CodeIgniter-1.5.4 folder there so I know which version I have installed. Really helps when you manage 12+ sites at a time.

  • #7 / Aug 06, 2007 10:39pm

    FrankieShakes

    35 posts

    My setup looks like this:

    /application/
        /config/
        /controllers/
        ...
        /views/
    /CodeIgniter-1.5.4/
        /system/
    /webroot/
        index.php

    As long as the $application_folder and $system_folder variables are set correctly in index.php, you can put your folders anywhere you want.

    I keep the CodeIgniter-1.5.4 folder there so I know which version I have installed. Really helps when you manage 12+ sites at a time.

    coolfactor,

    Are you able to run multiple sites off of the same “CodeIgniter-1.5.4” directory?  Or did I mis-read your post?

  • #8 / Aug 06, 2007 10:45pm

    coolfactor

    354 posts

    My setup looks like this:

    /application/
        /config/
        /controllers/
        ...
        /views/
    /CodeIgniter-1.5.4/
        /system/
    /webroot/
        index.php

    As long as the $application_folder and $system_folder variables are set correctly in index.php, you can put your folders anywhere you want.

    I keep the CodeIgniter-1.5.4 folder there so I know which version I have installed. Really helps when you manage 12+ sites at a time.

    coolfactor,

    Are you able to run multiple sites off of the same “CodeIgniter-1.5.4” directory?  Or did I mis-read your post?

    I do run multiple sites off a single installation of CodeIgniter, but each site has a symlink to that single installation, so it appears each site has its own installation. Does that make sense? You need to know how symlinks work to get that.

    What I described is how I do it. You can still keep your single installation of CodeIgniter in an entirely different place as long as you have filesystem access to it and set the $system_folder path correctly in index.php. That’s the key to this.

  • #9 / Aug 06, 2007 10:51pm

    FrankieShakes

    35 posts

    I do run multiple sites off a single installation of CodeIgniter, but each site has a symlink to that single installation, so it appears each site has its own installation. Does that make sense? You need to know how symlinks work to get that.

    What I described is how I do it. You can still keep your single installation of CodeIgniter in an entirely different place as long as you have filesystem access to it and set the $system_folder path correctly in index.php. That’s the key to this.

    Would you mind sharing how your symlink is setup?  I’m running on a Mac, not sure what OS you’re running.

    I’d prefer to share the same “core” between apps and save on disk usage.

    Also, I’m assuming in this case, that each application has its own “application” directory… stupid question, but I thought I’d clarify before I drive myself nuts. 😉

  • #10 / Aug 06, 2007 11:15pm

    coolfactor

    354 posts

    I’m on a Mac, as well. I have a Contextual Menu Item installed called “SymbolicLinker” that gives you the ability to create symlinks from right-click menus. Google it. Very handy thing to have.

    Once you have that installed, Put your CodeIgniter system folder where you want it to live, and then when you create a new website, simply right-click on the system folder and choose “Make Symbolic Link”. You’ll get a file called something like “system symlink”. Then just drag that file to where you want it in your new website. Remove the ” symlink” off the end, and then just treat it as if it were the real thing. Apache doesn’t know any different.

    When you go to FTP your files up the server, the real files get uploaded for you. It’s almost magical.

    (Note: you can not use regular Mac aliases for this. You must use symlinks.)

  • #11 / Aug 07, 2007 4:12am

    BravoAlpha

    51 posts

    On one particular server, I don’t have access outside the webroot, but using .htaccess to `deny from all` seems to work…

  • #12 / Aug 07, 2007 5:14am

    buggzzy

    2 posts

    Anybody knows if it’s possible to use helper apps like site_url with multiple applications and put the applications and core folder outside the document root?
    Trying this since some days but i didn’t see anyway to do this without to hack the core libs.

  • #13 / Aug 07, 2007 7:34am

    John_Betong

    690 posts

    Hi All,

    On one of my sites I have three separate URL’s all with the same DNN that share a single Ci_System folder.

    I set the index.php to recognise the URL and jump to the relevant folder. I should imagine the same thing could be achieved by using a .htaccess file?

    index.php

    switch ($_SERVER['SERVER_NAME']) {
          case 'localhost'          : 
                                      $application_folder = 'system/application'; // ncgecom      
                                      $application_folder = "plaroma-web-vhost";
                                      $application_folder = 'ci_fred';
                                      $application_folder = 'ci_jokes';       
                                      $application_folder = 'ci_betsprint';        
                                      $application_folder = 'ci_rentaroofbox';    
                                      break;
          case 'anetizer.com'       : 
          case 'www.anetizer.com'   : $application_folder    = 'ci_jokes';
                                      break;
          case 'betsprint.com'      : 
          case 'www.betsprint.com'  : $application_folder    = 'ci_betsprint';
                                      break;
          case 'justjoolz.com'      : 
          case 'www.justjoolz.com'  : $application_folder    = 'ci_jokes';
                                      break;
          case 'johns-jokes.com'    : 
          case 'www.johns-jokes.com': $application_folder    = 'ci_jokes';         break;
                                      break;
          default                   : // $application_folder = 'ci_rentaroofbox';  break;
      } // end switch

    This setup allows having a single set of files that work both for localhost and online.  (Similar switch statement for the database.php configuarion).

    Currently on my localhost I have to manually select the correct switch statement in the index.php file…

    ...BUT I have just been introduced to subdomains.  I have still not come to terms with the best way of handling numerous sites using this setup - any advice?

    Cheers,

    John_Betong
     

  • #14 / Aug 07, 2007 10:06am

    FrankieShakes

    35 posts

    I’m on a Mac, as well. I have a Contextual Menu Item installed called “SymbolicLinker” that gives you the ability to create symlinks from right-click menus. Google it. Very handy thing to have.

    Once you have that installed, Put your CodeIgniter system folder where you want it to live, and then when you create a new website, simply right-click on the system folder and choose “Make Symbolic Link”. You’ll get a file called something like “system symlink”. Then just drag that file to where you want it in your new website. Remove the ” symlink” off the end, and then just treat it as if it were the real thing. Apache doesn’t know any different.

    When you go to FTP your files up the server, the real files get uploaded for you. It’s almost magical.

    (Note: you can not use regular Mac aliases for this. You must use symlinks.)

    Sweet… I just downloaded SymbolicLinker, and I’ll definitely be giving your method a try.  It seems so obvious now… just not sure why it wasn’t before. 😉

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases