Created
September 12, 2013 21:39
-
-
Save sambody/6544213 to your computer and use it in GitHub Desktop.
Multi environment (servers) wordpress config file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if( stristr( $_SERVER['SERVER_NAME'], "dev" ) ) { | |
// Dev Environment | |
define( 'DB_NAME', 'project_dev' ); | |
define( 'DB_USER', 'project_dev_user' ); | |
define( 'DB_PASSWORD', 'password' ); | |
define( 'DB_HOST', 'localhost' ); | |
define( 'WP_HOME', 'http://project.dev'); | |
define( 'WP_SITEURL', WP_HOME); | |
// Dev will always want debug on and caching off | |
define( 'WP_DEBUG', true ); | |
define( 'WP_CACHE', false ); | |
} elseif( stristr( $_SERVER['SERVER_NAME'], "test" ) ) { | |
// Test Environment | |
define( 'DB_NAME', 'project_test' ); | |
define( 'DB_USER', 'project_test_user' ); | |
define( 'DB_PASSWORD', 'password' ); | |
define( 'DB_HOST', 'localhost' ); | |
define( 'WP_HOME', 'http://project.test'); | |
define( 'WP_SITEURL', WP_HOME); | |
// Testing will always want debug on and caching off | |
define( 'WP_DEBUG', true); | |
define( 'WP_CACHE', false); | |
} elseif( stristr( $_SERVER['SERVER_NAME'], "uat" ) ) { | |
// UAT Environment | |
define( 'DB_NAME', 'project_uat' ); | |
define( 'DB_USER', 'project_uat_user' ); | |
define( 'DB_PASSWORD', 'password' ); | |
define( 'DB_HOST', 'localhost' ); | |
define( 'WP_HOME', 'http://project.uat'); | |
define( 'WP_SITEURL', WP_HOME); | |
// UAT Environment will always be the same as production so turn off debug and turn on caching | |
define( 'WP_DEBUG', false ); | |
define( 'WP_CACHE', true ); | |
} else { | |
// Production Environment | |
define( 'DB_NAME', 'project_live' ); | |
define( 'DB_USER', 'project_live_user' ); | |
define( 'DB_PASSWORD', 'password' ); | |
define( 'DB_HOST', 'localhost' ); | |
define( 'WP_HOME', 'http://project.com'); | |
define( 'WP_SITEURL', WP_HOME); | |
// Live Environment will always be the same as production so turn off debug and turn on caching | |
define( 'WP_DEBUG', false ); | |
define( 'WP_CACHE', true ); | |
} | |
define('DB_CHARSET', 'utf8'); | |
define('DB_COLLATE', ''); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment