• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Directory Structure Best Practices

#1
[eluser]chrisco23[/eluser]
Hi All,

When I built my first codeigniter project about 1.5 years ago, I put some directories at the same level as /system: stuff that I didn't want to be accessible directly, like javascript, images, captchas, etc.

I was thinking now that maybe that's not optimal when it comes to upgrading.

Anyone have a better suggestion or are other people doing things this same way?


Thanks,
Chris

#2
[eluser]thurting[/eluser]
The only CI file I place in the web root is index.php. I keep the system and application folders above the root so they can't be accessed. All public assets (img, js, css, etc) are also located in the web root.

#3
[eluser]chrisco23[/eluser]
That's interesting. So which files did you have to modify to make that happen? index.php and config.php? What about routes.php?

Also, is the upgrade process simple enough? I'm already on 1.5.4 but am thinking about the next time an upgrade comes out.


Thanks,
Chris

#4
[eluser]Référencement Google[/eluser]
I personally organise myself as you can see on the image joined

#5
[eluser]chrisco23[/eluser]
elitemedia: So you don't hide anything above the webroot? Do you use .htaccess to prevent access to certain directories?

#6
[eluser]thurting[/eluser]
[quote author="chrisco23" date="1194047845"]That's interesting. So which files did you have to modify to make that happen? index.php and config.php? What about routes.php?

Also, is the upgrade process simple enough? I'm already on 1.5.4 but am thinking about the next time an upgrade comes out.


Thanks,
Chris[/quote]

Just edit $system_folder and $application_folder in index.php to point to your directories. Upgrading is incredibly simple. The CI core files are separate from any application files so when a new version comes out I can just dump it in the system folder. The app files are contained too so any changes I have to make there are clear.

#7
[eluser]Référencement Google[/eluser]
[quote author="chrisco23" date="1194056945"]elitemedia: So you don't hide anything above the webroot? Do you use .htaccess to prevent access to certain directories?[/quote]

No I don't hide nothing, I don't see any reason to do that until I make standards apps that don't require paranoid security levels.

Protecting pictures? For what? First because this is browser client stuff and it's so easy to get back that stuff from cache. Also, if the user can print it on screen, then there is no protection for my pictures because anybody can make a printscreen of them.

There are sure some apps that will require more protection, this case didn't happend to me yet. If I have to face this situation, I think I will protect with .htaccess


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.