- Insure that settings.php is writeable - \sites\default\settings.php
- Find, in settings.php code line 627 (where the comments/instructions begin)
- Close said comments and add your host as follows.

e.g.

$settings['trusted_host_patterns'] = array(
  'mysitename.localhost',
);

^^^Without opening/closing PHP tags.

Comments

Wolf_22’s picture

For anyone else out there who stumbles across this, be sure to verify which "sites" install path you're browser session is accessing if you've created a multi-environment installation on your localhost.

For example, if from your localhost configuration you have multiple HOSTS entries to synthesize your production or test environments or stages, be sure that you verify which settings.php file your browser instance is processing. Since I was doing work for multiple environments using my single Drupal install, I have multiple "sites" folders (i.e. - sites/testsite, sites/prodsite, etc.) and since all use their own settings.php file, your admin interface may display state settings which fool you into thinking that something might be wrong when you access your site at localhost/mysite, which will fallback on the sites/default installation profile only to later realize that if you only went instead to "localhost.mysite.com," the site would've looked and acted as expected.

Things that play a part in troubleshooting this (and ultimately leading to the realization) are the HOSTS file, any .HTACCESS redirects you have throughout your respective web server file paths (check web root, then check your project folders), and of course, the sites/folderX folders themselves for their respective settings.php files.

Just thought I'd put all this out there because I was just bitten by my default profile which made it look like I didn't have my trusted sites stuff configured when in fact, I did, I was just accessing the wrong installation profile. One of those "tree in the forest" things.

Hope this helps.