I'm running in to the error message The provided host name is not valid for this server.

I found the previous solution here however even once updating my settings.php file I'm continuing the hit this problem.

My two domains are almost identical however the second one includes an a at the beginning. Therefore my two trusted_host_patterns are exactly the same except that the second one includes an a after the ^. Is it possible that there is something else I'm missing? Looking in admin/reports/status I can see the two domains listed under trusted hosts.

Here's the line:

 $settings['trusted_host_patterns'] = array(
  • Can you post your setting? Dots need to be escaped with a backlash ..
    – rémy
    Sep 25, 2019 at 21:49
  • @rémy Yep, updated the original post.
    – Eabryt
    Sep 25, 2019 at 22:05
  • Okey, this will work if you access the page without www.
    – rémy
    Sep 26, 2019 at 6:20
  • Okay, should I add two more rules for when it's www first then? I believe most of the time I'm simply typing adomain.com, but maybe it's getting autofilled to have the www
    – Eabryt
    Sep 26, 2019 at 15:18
  • Yes add the versions with www\., if you do not have set a preferred domain.
    – rémy
    Sep 27, 2019 at 21:36


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.