How to remove subdir from base URL after installing site with Composer on a shared host?
Me and my collegue managed to find a working solution.

In our public_html folder we created a .htacess file with the following lines.

RewriteRule ^$ web/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ web/$1 [L] 


We edited the .htaccess file in ~user/public_html/web.

# Modify the RewriteBase if you are using Drupal in a subdirectory or in a
# VirtualDocumentRoot and the rewrite rules are not working properly.
# For example if your site is at http://example.com/drupal uncomment and
# modify the following line: 
RewriteBase /web


In the ~/user/public_html/web/sites/default/settings.php file, we added this code at the bottom.

if (isset($GLOBALS['request']) and
'/web/index.php' === $GLOBALS['request']-&gt;server-&gt;get('SCRIPT_NAME')) {
$GLOBALS['request']-&gt;server-&gt;set('SCRIPT_NAME', '/index.php');
}


We also changed trusted_host_patterns setting as well.

# will allow the site to run off of all variants of example.com and
# example.org, with all the sub-domains included. 

$settings['trusted_host_patterns'] = array(
  '^DOMAIN.com$',
  '^.+.DOMAIN.com$',
  '^DOMAIN.com/web$',
  '^.+.DOMAIN.com/web$',
);


As I said, this is most likely not the correct way to do it, but it worked for us.