Drupal 8/9 web rooth and Redirects to external URLs are not allowed by default
On some host we need to put drupal 8/9 files and folders put in to folder with name "web", so structure will be like publi_html/web but not to all host after that work properly. Somethimes your site start to view 500 error. In this case, in public_html created .htaccess file, with code
<IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^$ web/$1 [L] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ web/$1 [L] </IfModule>
and site will work.
But somethimes, on specific page appears error
Redirects to external URLs are not allowed by default
For this case, in your settings.php add code
if (isset($GLOBALS['request']) and
'/web/index.php' === $GLOBALS['request']->server->get('SCRIPT_NAME')) {
$GLOBALS['request']->server->set('SCRIPT_NAME', '/index.php');
}