For Drupal 10 there's a recommended project structure (httpdocs/web, httpdocs/vendor) and a legacy structure (httpdocs, httpdocs/vendor). These are suitable for sites on shared hosts that provide SSH access only to a single server directory.
Provided you have full root access to the server, another option is to move the recommended structure one level up, while Apache still uses httpdocs as DocumentRoot. This separates Composer files from the website even more clearly.
domain/composer.json
domain/composer.lock
domain/httpdocs/... (Drupal site)
domain/vendor/...
I used this with non-Drupal PHP projects, so Composer is basically fine with it. Now I wonder how to configure Drupal 10 in order to work with this structure, too. Moving the files obviously isn't enough, so what else is needed to make this work?
/web
and a/vendor
directory. It doesn't matter where those 2 directories are. They can be in ahttpdocs/web/
, they could in root/web
, they could be/somewhere/over/the/rainbow/web
...web
ordocroot
withhttpdocs
. Other than updating the web root path in composer.json, there’s nothing else to do (unless we’ve misunderstood)