Sunday, March 28, 2010

How to run WordPress locally against a live database

If you try to run a local version of WordPress against a live database, you will be redirected to the live URL. The reason for this is that the URL is defined in the database (wp_options table). In order to work around this, you can add the local URL to the /wp-config.php file:

define('WP_SITEURL', 'http://localhost:81');
define('WP_HOME', 'http://localhost:81');