Skip to content

Instantly share code, notes, and snippets.

@marktiderman
Forked from phillipadsmith/wp-config.php
Created January 9, 2014 18:01
Show Gist options
  • Save marktiderman/8338844 to your computer and use it in GitHub Desktop.
Save marktiderman/8338844 to your computer and use it in GitHub Desktop.
if ($_SERVER['REMOTE_ADDR']=='127.0.0.1') {
define('WP_ENV', 'local');
} elseif ($_SERVER['HTTP_HOST']=='develop.project.com') {
define('WP_ENV', 'develop');
} elseif ($_SERVER['HTTP_HOST']=='master.project.com') {
define('WP_ENV', 'develop');
} else {
define('WP_ENV', 'production');
}
$server = preg_replace ('/:.*/',"", $_SERVER['HTTP_HOST']);
if ( WP_ENV == 'develop' ) {
define('DB_NAME', 'project_dev');
define('DB_USER', '');
define('DB_PASSWORD', '');
define('DB_HOST', 'localhost');
define('WP_SITEURL', "http://$server");
define('WP_HOME', "http://$server");
define('DISALLOW_FILE_MODS',true);
} elseif ( WP_ENV == 'production' ) {
define('DB_NAME', 'project_live');
define('DB_USER', '');
define('DB_PASSWORD', '');
define('DB_HOST', 'localhost');
define('DISALLOW_FILE_MODS',true);
} elseif ( WP_ENV == 'local' ) {
define('WP_SITEURL', "http://$server");
define('WP_HOME', "http://$server");
define('DB_NAME', 'project_dev');
define('DB_USER', '');
define('DB_PASSWORD', '');
define('DB_HOST', 'localhost');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment