Hello. I installed version 8.3.7 and made the proper settings apparently. I read about this problem, which generates the phrase: "Redirects to external URLs are not allowed by default, use \ Drupal \ Core \ Routing \ TrustedRedirectResponse for it." I took the necessary steps like changing the settings.php file and inserting:

$settings['trusted_host_patterns'] = [
  '^gersonvagner\.com$',
  '^www\.gersonvagner\.com$',
  '^localhost$',
];

However the problem persists in some instances, as for example when I try to put the site under maintenance. I do not know where else I might be going for more than a week of testing and reading. If anyone can help me.

Thank you in advance!

Comments

gersonvagner’s picture

For me, my foolishness! I just needed to uncomment 'RewriteBase /' in '.htacess' today and work.

stephesk8s’s picture

This worked for me as well. We are doing some super weird stuff here running a new Drupal site alongside an old CF site. This was the last error to track down in terms of Rewrite rules to make things work. Thanks for posting!

gersonvagner’s picture

Wonderful! Glad to be helpful! Success! Hug!

auxiliaryjoel’s picture

I have my drupal site sitting in this directory:
public_html/web/

and I've added a redirect in the public_html directory's .htaccess folder.

This works when loading front-end pages like the landing page and main nav links, but if I try and login via:

domainname.com/user

then I get the error

I uncommented the Rewrite line from the .htaccess in the Drupal folder (public_html/web/) but this did not fix it.

the Rewrite line is not present in the top level(public_html) htaccess, should I add it there instead?

auxiliaryjoel’s picture

#46 from this thread solved it for me:
https://www.drupal.org/project/drupal/issues/2612160#comment-12953709

BUT...

Now that I have this working,
I've noticed that my "git push..." no longer works.
It may be a coincidence, or it may be due to this redirect in place?

This is the git command I run:
git push origin2live master
note: this has worked on all other occasions for months,

I received an error.
At first I thought I may have had changes on server, so I tried to override them:
git push -f origin2live master

the error that I'm getting when trying to git push to my live shared hosting server is:

Counting objects: 13, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (13/13), done.
Writing objects: 100% (13/13), 1.21 KiB | 1.21 MiB/s, done.
Total 13 (delta 10), reused 0 (delta 0)
To path/to/my/repo/public_html/.git
! [remote rejected] master -> master (Working directory has unstaged changes)
error: failed to push some refs to 'ssh://path/to/my/repo/public_html/.git'

Has anyone else had experiences with this that relate to the changes as per #46?

gersonvagner’s picture

Unfortunately I do not know how to help you otherwise. I'm on another project currently and far from Drupal a bit, moreover I'm just an enthusiast. Let's hope that other colleagues will help us in this new problem. Hugs!

Anne-Pierre’s picture

Thank you! 

gersonvagner’s picture

Nice! Glad it was helpful. I wish you success!