I have a general question to do with application directory structure. I have my application and all the files required on a git repo that is regularly updated (PHP files, CSS, JS etc). And I have an uploads folder where users' uploaded avatars and files get stored.
Is it convention to separate these two parts of the app for example?:
public_html
/app
/uploads
or should the directory structure look more like this?:
public_html
/index.php
/css
/js
/uploads
When I merge changes from github I don't want any of my users' files to be affected.
/uploads
to .gitignore?I think both structures are fine -- it's up to you. As long as the uploads are in a seperate folder, you can exclude that from versioning and you should be fine. Your .htaccess can be in the versioning system as well.
I'd rather use the second option, if the uploads are not shared by different apps they should be part of the app so I would place it inside app's directory, and include it in .gitignore.
Both approaches are fine I guess. But for me the app structure should be like this, not everything should go in the public directory, only the things that need to be accessed by the user (server exclusive files should be protected from users)
/app
/public_html
index.html
/css
/js
/class
/conf
/upload
..
class, conf, upload, ... should only be accessed by the server