Frage

My Drupal 8 site only works with www. but without it I'm getting a WSOD with the "The provided host name is not valid for this server" error.

I've tried to implement the suggestions from this thread: What does "The provided host name is not valid for this server" mean?

Specifically I tried:

$settings['trusted_host_patterns'] = array(
  '^www\.example\.com$',
  '^example\.com$'
);

$settings['trusted_host_patterns'] = [];

$settings['trusted_host_patterns'] = [ '.*' ];

Still, site will only work with www

War es hilfreich?

Lösung

You need to add your domains into the array as per your first example. I.e.

    $settings['trusted_host_patterns'] = array(
  '^www\.yourdomain\.co\.uk$',
  '^yourdomain\.co\.uk$',
);

Then clear the caches and the message should go away. It may be that you're missing the comma after your second entry.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit drupal.stackexchange
scroll top