How to configure Trusted_Host_Settings for subdomains?

by David   Last Updated April 27, 2018 00:07 AM

How to configure Trusted_Host_Settings for subdomains?

The documentation does not give an example of a subdomain.

For example, I have an Add-On domain that points to website.info, but the subdomain is mainsite.com/website.info



Answers 1


It's actually documented in settings.php file as in examples:

Drupal 8.5.x
https://cgit.drupalcode.org/drupal/tree/sites/default/default.settings.php?h=8.5.x#n712

<?php
$settings['trusted_host_patterns'] = array(
  '^example\.com$',           // Matches naked domain only.
  '^.+\.example\.com$',       // Matches any subdomains.
  '^subdomain\.example\.com', // Matches a specific subdomain.
);

You can easily define any naked or sub-domain, as long as defined regex pattern matches them correctly.

osman
osman
April 26, 2018 23:58 PM

Related Questions


Using Configuration API in drupal 8

Updated June 15, 2015 23:03 PM




Config folder in drupal8

Updated April 13, 2016 08:03 AM