Wordpress: Moving From Development or Staging to Live
Friday, April 17, 2009
Pigeon-holed in “Web-Design”
It’s been a long annoyance of mine that Wordpress insists on writing paths directly into the database, so when switching from staging or production to live you have to alter these paths.
However, if you also find this an irritation, a quick way to solve it is to define a couple of constants in the wp-config.php file. You simply define the url and home addresses as below, and as long as you are running a server that supports the server variable HTTP_HOST (e.g. Apache) the switch should be automatic and override the settings in the control panel.
// WordPress address on settings page
define(’WP_SITEURL’, $_SERVER[‘HTTP_HOST’]);
// Blog address on settings page
define(’WP_HOME’, $_SERVER[‘HTTP_HOST’]);