AnswerBun.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!

Related Questions

KernelEvents::REQUEST is not fired on cached pages

2  Asked on December 8, 2021 by user34185

     

Add column to custom field schema

3  Asked on December 8, 2021 by coder1

 

Order receipt email content

1  Asked on December 8, 2021 by pete-l

 

Date time save in database

0  Asked on December 8, 2021 by pratip-ghosh

   

How can I create a recommended project in the root directory?

2  Asked on December 6, 2021 by user2574948

   

Wrapping fields together in a Views Exposed Filter

1  Asked on December 4, 2021 by typologist

   

Submit form and disable submission button

7  Asked on December 4, 2021 by matt9292

   

How to check if an entity is referenced before deleting?

2  Asked on December 2, 2021 by halofx

   

Add class to {{ link }} twig attribute

3  Asked on December 2, 2021

   

Remove field attributes using hook_form_alter()

1  Asked on November 30, 2021 by senthilkumar

 

How to send email to submitter in a webform?

2  Asked on November 30, 2021 by cel57

     

Ask a Question

Get help from others!

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