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 :)

  • Does HTTP_HOST include custom port? If not you will need to add this as needed.
    – Rarst
    Dec 13, 2011 at 18:22

3 Answers 3


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/');

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):



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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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