Locked out of Drupal 8 site, and new user can't get in
For a while it seemed that adding localhost to the Trusted Host settings in settings php did some good, then I realized it didn't so I removed it, leaving just the lines below:

$settings['container_yamls'][] = $app_root . '/' . $site_path . '/services.yml';
$settings['trusted_host_patterns'] = array(
'^mydomain\.com$',
'^.+\.mydomain\.com$',
);


I think the Trusted Host settings is critical for several reasons. But then out of the blue I somehow found I can enter the site by logging into 

mysite/user/login

Even though it throws the error page with this message:

Redirects to external URLs are not allowed by default, use \Drupal\Core\Routing\TrustedRedirectResponse for it.

However I'm actually logged in. All I have to do is append the site folder name to the path then I'm in.

http://www.mysiteurl/sitefolder/ 

In fact, I can just log in by going to 

http://www.mysiteurl/sitefolder/user/login

The sitefolder added to the URL seems to be an alternate url for the entire site. I don't know if that will cause a problem but at least most of my problems are solved for now. 

I hope this helps somebody. It seems to result from shared hosting not letting me install my primary site to a subfolder in public_html without making a fancy adjustment in htaccess.