TransWikia.com

Getting error 'Redirects to external URLs are not allowed by default'

Drupal Answers Asked by Joehoe on November 13, 2021

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 DrupalCoreRoutingTrustedRedirectResponse 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.

One Answer

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');
}

Answered by kufeiko on November 13, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP