-
-
Save derekjohnson/29b32e24eff18590a0aa to your computer and use it in GitHub Desktop.
This file contains hidden or 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
/* Lets not rely on paths in the database, they can be very wrong when moving between dev/stage/live environments */ | |
/* The following two variables are backward to my thinking, but hey, what ya gonna do? */ | |
define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST'] . ''); // This is NOT the 'wordpress admin area' home, but the site's home | |
define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] . '/SECRETDIRECTORY'); // This isn't the site's URL but the WordPress admin area URL | |
/* MySQL settings */ | |
switch($_SERVER['SERVER_NAME']){ | |
// Your local machine's settings | |
case 'mysite.local': | |
define('DB_NAME', 'dev_mysite'); | |
define('DB_USER', 'dev_mysite'); | |
define('DB_PASSWORD', 'password'); | |
define('DB_HOST', 'mysql.local'); | |
break; | |
// Your staging server's settings | |
case 'mysite.testing.com': | |
define('DB_NAME', 'stage_mysite'); | |
define('DB_USER', 'stage_mysite'); | |
define('DB_PASSWORD', 'otherpassword'); | |
define('DB_HOST', 'localhost'); | |
break; | |
// your live site's settings | |
default: | |
define('DB_NAME', 'mysite'); | |
define('DB_USER', 'mysite'); | |
define('DB_PASSWORD', 'livepassword'); | |
define('DB_HOST', 'localhost'); | |
break; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment