Skip to content

Instantly share code, notes, and snippets.

@chrisjlee
Last active September 27, 2015 07:47
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save chrisjlee/1235389 to your computer and use it in GitHub Desktop.
Save chrisjlee/1235389 to your computer and use it in GitHub Desktop.
Drupal Settings file router - localhost / etc
/*
* At the end of the settings.php file for drupal add these lines
*/
/*
* Settings file routing
*/
if (file_exists(dirname(__FILE__) . '/local.settings.php')) {
include dirname(__FILE__) . '/local.settings.php';
}
if (file_exists(dirname(__FILE__) . '/stage.settings.php')) {
include dirname(__FILE__) . '/stage.settings.php';
}
@chrisjlee
Copy link
Author

Use this to reroute and redefine your local settings. Inspired by a drupal.stackexchange answer here: http://drupal.stackexchange.com/questions/9/suggestions-for-settings-php-local-dev-development-server-live-server/41#41

Examples of local.settings.php

For good examples of what a local.settings should look like check out:

Quick installation

curl https://gist.github.com/chrisjlee/1235389/raw/e8c083eedea71fa9c1c86ccba126771cfbc956e5/settings-router.php | sudo tee -a sites/default/settings.php

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment