/*
* Multi-Environment Config part for WordPress
* By [email protected]
*
* Determines the current domain hosting, and calls
* the corresponding configuration file, defined by
* the "WP_ENV" constant.
*
* Ex.: Config file part name => config.[WP_ENV].php
*
*/
define('HOSTNAME', $_SERVER['SERVER_NAME']);
switch (HOSTNAME) {
case 'stage.mytestsite.local':
define('WP_ENV', 'stage');
break;
//case 'dev.mytestsite.local':
default:
define('WP_ENV', 'dev');
break;
}
include_once('wp-config.'. WP_ENV .'.php');
File name: config.dev.php
<?php
/* DEV */
define('DB_NAME', 'mydatabasename');
define('DB_USER', 'mysqluser');
define('DB_PASSWORD', 'mysqlpassword');
define('DB_HOST', 'mydatabasehost');
define('WP_SITEURL', 'http://dev.mytestsite.local/');
define('WP_HOME', WP_SITEURL);
File name: config.stage.php
<?php
/* STAGE */
define('DB_NAME', 'mydatabasename');
define('DB_USER', 'mysqluser');
define('DB_PASSWORD', 'mysqlpassword');
define('DB_HOST', 'mydatabasehost');
define('WP_SITEURL', 'http://stage.mytestsite.local/');
define('WP_HOME', WP_SITEURL);