Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Directory Structure: Separating the application from uploaded files

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.

  1. So should the app be physically separated from the uploads or should I just include /uploads to .gitignore?
  2. What if any .htaccess rewrites are required?
like image 484
wilsonpage Avatar asked Jul 23 '26 17:07

wilsonpage


1 Answers

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.

like image 136
Rijk Avatar answered Jul 25 '26 07:07

Rijk



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!