Skip to content

Instantly share code, notes, and snippets.

@lukejones
Created September 24, 2012 09:02
Show Gist options
  • Save lukejones/3775027 to your computer and use it in GitHub Desktop.
Save lukejones/3775027 to your computer and use it in GitHub Desktop.
Multiple development environments within wp-config
<?
// Database settings
switch($_SERVER['SERVER_NAME']) {
// Local Environment
case 'localhost':
define('DB_NAME', 'db_name');
define('DB_USER', 'db_user');
define('DB_PASSWORD', 'db_password');
define('DB_HOST', 'localhost');
break;
// Production environment
case 'www.domain.com':
case 'domain.com':
define('DB_NAME', 'db_name');
define('DB_USER', 'db_user');
define('DB_PASSWORD', 'db_password');
define('DB_HOST', 'localhost');
break;
}
// Authentication key: https://api.wordpress.org/secret-key/1.1/salt/
define('AUTH_KEY', '');
define('SECURE_AUTH_KEY', '');
define('LOGGED_IN_KEY', '');
define('NONCE_KEY', '');
define('AUTH_SALT', '');
define('SECURE_AUTH_SALT', '');
define('LOGGED_IN_SALT', '');
define('NONCE_SALT', '');
// WordPress Database Table prefix.
$table_prefix = 'wp_';
// WordPress Localized Language, defaults to English.
define('WPLANG', '');
// Absolute path to the WordPress directory.
if ( !defined('ABSPATH') )
define('ABSPATH', dirname(__FILE__) . '/');
// Sets up WordPress vars and included files.
require_once(ABSPATH . 'wp-settings.php');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment