Here's my scenario:

I have a development zone with a standard WordPress installation (dev.domain.com/project). When it comes time to showing work to clients, I use version control to copy the dev installation to a beta zone (beta.domain.com/project). So, a pretty standard setup. They share the same database.

However, using this method in wp-config.php on the beta zone to change the site and home URL doesn't work:


Because it alters the value in the database, meaning that when I go to load the dev zone, it now redirects to the beta zone. This is what happens for pretty much all methods described here.

So, what is the proper way to have two separate installations with different URL's share the same database? I know of the WP DB Migrate plugin, which I've already used, but in this case I want the databases to be shared.

  • I can't imagine why do u need to share one db between 2 web.. if you'll be able to acomplish your goal, then on editing something on eny of 2 installs, u'll change on seccond web.. so u can't setup different themes, activate different plugins.. there's no use in seccond website. Search engins will doungrade your rating becouse of dublicate content.. So what posible reason is to do 2 websites with single database ? But if u need to be able to change only few tables ( like wp_posts and wp_postmeta ) you can do it by rewriting them in posts_where, with $table_prefix = 'wp_'; different.. – Михаил Семёнов Jan 16 '15 at 18:08

Silly me, I posted this before doing a proper investigation.

The issue isn't with WordPress, it was instead with how Polylang (translation plugin) handled the site url. The solution was to put define('PLL_CACHE_HOME_URL', false); in the wp-config.php before I changed the URL using the WP constants.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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