Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Talk:Running a Development Copy of WordPress

Just a note to say that i revised my post because there was a small bug in it for Windows users which is fixed in the latest version

(replaced '/..' with DIRECTORY_SEPERATOR.'..')BenXO 18:46, 15 May 2006 (GMT)


Just a note on this bit: "there's a simple hack for functions.php that can doesn't require you to update your database"

...talks about functions.php but the article is mostly focused on wp-config.php

Also "can doesn't" ?

Bug in WP_LOCATION code sample redirects to https

function WP_LOCATION assumes $_SERVER['HTTPS'] returns null if http

At least for IIS, the value is "off" causing redirection to https.

This line should be replaced: $retval = 'http' . ($_SERVER['HTTPS'] ? 's' : null) . '://' . $_SERVER['HTTP_HOST'] . $wp_path ;

This line is correct: $retval = 'http' . ($_SERVER['HTTPS'] == "on" ? 's' : null) . '://' . $_SERVER['HTTP_HOST'] . $wp_path ;

using wp-config

Wouldn't this be easier in wp-config.php?

Add: define( 'WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] ); define( 'WP_HOME', 'http://' . $_SERVER['HTTP_HOST'] ); define( 'WP_CONTENT_URL', 'http://' . $_SERVER['HTTP_HOST'] . '/wp-content' );'

to the top of your wp-config file.

Or if you don't want to modify wp-config at all, add thhttp://codex.wordpress.org/Talk:Running_a_Development_Copy_of_WordPressat to a new file named local-dev.php and add something like this to your Apache config file:

<VirtualHost *80>
 ... regular apache config stuff here ...
 Php_value auto_prepend_file /path/to/your/local/config/file/local-dev.php

This will prepend it to web request for the given virtual host. If you're using one of the popular *.dev VirtualHost setups for multiple sites, this will make it so you don't have to modify all of your wp-config files.