WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to synchronize development between a Windows user (WAMP) and a Mac user (Regular Apache).

Windows User (me) Since I use IIS I need my port 80 so I have changed the ports on WAMP to :666.

So the url to the Wordpress is http://localhost:666/projectname/

Mac user He has the site on a non-alias, just the path the the project

So the url is http://localhost/foldername/wordpress/

In wp-config.php I have the following code

if (file_exists('local_settings.php')) {
} else {
$debug_on = true;

And in the local_settings.php

define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST'] . '/projectname/');
define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] . '/projectname/');

But this code doesn't seem to actually override the damn stupid database siteurl because when he tries to login, it still heads to localhost:666 (which is the value in the database).

Or is it impossible to sync different developers? How do you guys do it? And please don't ask me to change my port to :80 :)

share|improve this question
Does HTTP_HOST include custom port? If not you will need to add this as needed. – Rarst Dec 13 '11 at 18:22
up vote 1 down vote accepted

You need to have 2 sets of settings one for if file_exists and one for else:

if ( file_exists( dirname( __FILE__ ) . '/local-config.php' ) ) {
  include( dirname( __FILE__ ) . '/local-config.php' );
  define( 'WP_LOCAL_DEV', true ); 
} else {
  define('WP_HOME', 'http://localhost:666/projectname/');
  define('WP_SITEURL', 'http://localhost/foldername/wordpress/');
share|improve this answer
That sorted it out, thank you :) – Viktor Sarström Dec 13 '11 at 18:45

Edit: Ignore this answer.

The constants have already been defined. It's not possible to redefine constants in PHP.

Try including local_settings.php before the following line in wp-settings.php (instead of wp-config.php):


share|improve this answer

My team and I usually change the domain in the DB for each local environment.

You can do it manually or run a two liner in functions.php:


You only have to run this update once in the Mac user's machine.

reference: http://codex.wordpress.org/Changing_The_Site_URL

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.