Getting error 'Redirects to external URLs are not allowed by default' Getting the error after created this .htacces in root folder.

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^/web
RewriteRule ^(.*)$ /web/

I want to redirect visitors to /web folder. I can login as Admin and enable modules, install themes and create content without any issues. 

When a theme is installed, content created and publish it I get a blankpage with:

"Redirects to external URLs are not allowed by default, use \Drupal\Core\Routing\TrustedRedirectResponse for it."

I have trusted hostsettings configured like this in settings.php

$settings['trusted_host_patterns'] = array(
  '^my-domain\.com$',
  '^my-domain\.com\.web$',
  '^.+\.my-domain\.com$',
  '^.+\.my-domain\.com\.web$',

according to this issue uncomment RewriteBase / didn't work out either

Hope someone has a solution to this.
If you still haven't figured this out, check this comment on d.o: https://www.drupal.org/project/drupal/issues/2612160#comment-11767977

It suggests a workaround by removing the subdir from the script name, adding to settings.php the following:


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