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.

2 Answers 2


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']->server->get('SCRIPT_NAME')) {
$GLOBALS['request']->server->set('SCRIPT_NAME', '/index.php');

You should change move the content of web to the root directory, this a step by step to do it. https://tecnovatorexperts.com/articles/fixing-drupal-redirect-error-how-use-trustedredirectresponse-external-urls

  • Welcome to Drupal Answers! Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference.
    – mpdonadio
    May 13 at 18:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.