Skip to main content

Drupal setting in live server & localhost

Drupal setting in live server & localhost

When we want to transfer Drupal site to the live server, we need to change setting in setting.php file. Here is the things we need to change. This example for Drupal 10.

setting in localhost

 */
  $settings['trusted_host_patterns'] = [
  '^localhost$',
  '^127\.0\.0\.1$',
  ];
/**
 
$databases['default']['default'] = array (
  'database' => 'databasename',
  'username' => 'username',
  'password' => 'password',
  'prefix' => '',
  'host' => 'localhost',
  'port' => '3306',

setting in live server

 */
  $settings['trusted_host_patterns'] = [
  '^www\.example\.com$',
  ];
/**
 
$databases['default']['default'] = array (
  'database' => 'databasename',
  'username' => 'root',
  'password' => '',
  'prefix' => '',
  'host' => 'localhost',
  'port' => '3306',
Google AdSense
client = ca-pub-2898279488603899
slot = 9058461004
format = auto