Wordpress configuration file

Wordpress' configuration file is the wp-config.php file that is located in the top most wordpress directory. In this configuration file we should include our database parameters and our home and siteurl location directives.

Following is an example of configuration file settings that we use which allows us to deploy the website between servers.

if (strpos($_SERVER['HTTP_HOST'], 'localhost') !== false) { //dev define('DB_NAME', 'crystalw_website'); define('DB_USER', 'root'); define('DB_PASSWORD', ''); define('DB_HOST', 'localhost'); define('ABSPATH', '/www/websites/marcwatts.com.au/'); define('WP_SITEURL', 'https://crystalwebdesignscomau.localhost'); define('WP_HOME', 'https://crystalwebdesignscomau.localhost'); } else if (strpos($_SERVER['HTTP_HOST'], 'staging.') !== false) { //staging define('DB_NAME', 'crystalw_website'); define('DB_USER', 'USER'); define('DB_PASSWORD', 'PASSWORD'); define('DB_HOST', 'localhost'); define('ABSPATH', '/home/crystalw/public_html/'); define('WP_SITEURL', 'https://staging.crystalwebdesigns.com.au'); define('WP_HOME', 'https://staging.crystalwebdesigns.com.au'); } else { //live define('DB_NAME', 'crystalw_website'); define('DB_USER', 'USER'); define('DB_PASSWORD', 'PASSWORD'); define('DB_HOST', 'localhost'); define('ABSPATH', '/home/crystalw/public_html/); define('WP_SITEURL', 'https://www.crystalwebdesigns.com.au'); define('WP_HOME', 'https://www.crystalwebdesigns.com.au'); }

By setting your wordpress configuration file with the above settings you can transfer the site between servers without hassles and problems.