8

My question is this:

Is it possible to have two separate installations of WP with two separate domains sharing the same content?

Scenario: User on http://A.mysite.com publishes a post. http://B.mysite.com uses the exact same database and can show that post as if it was its own.

I've been looking around for quite some time for this solution and cannot find a valid procedure to achieve this.

My ideas are:

  1. Is there a way to share the database without having the issue of the siteurl and theme stored in the database be an issue.
  2. Maybe use just an RSS feed and somehow parse the XML and display them in a template. This is not the best idea because it would have zero functionality that WordPress provides.
  3. Find a way to somehow sync the databases but exclude the wp_options table ?
8
  • 1
    Only theme is different in both domains or they may have different plugins, admin settings and options?
    – M-R
    Dec 13, 2012 at 19:32
  • 1
    Will site B need to be edited on it's own as well? Or is it strictly a mirror with no unique administration? Dec 13, 2012 at 20:14
  • 1
    The theme would be different as well as some of the plugins and admin settings. Dec 13, 2012 at 20:21
  • 1
    Kristina, It would be strictly a mirror. Only purpose is to display the blog posts from the original site. Dec 13, 2012 at 20:23
  • 1
    You might want to look into the effect this would have on SEO. I'm pretty sure Google doesn't like duplicate content. Dec 13, 2012 at 20:26

2 Answers 2

1

If your main requirement is to synchronise blog posts from a master site to a slave, then maybe look at the FeedWordPress plugin. It means that you would only add/edit posts on one website and they would be replicated to the other site. That will allow you to cleanly run different plugins on the two sites.

2
  • webaware, thank you very much! That is exactly the situation we need to preceed with and this plugin is a near perfect solution to this issue. It doesn't require any massive database syncing or unstable hacks to the WordPress theme. In fact the only thing I have to add was a function to include the post's featured image using the_content_rss filter. Thanks a million. I will also be donating to this developer's plugin. Cheers. Dec 14, 2012 at 2:07
  • Yes, it got me out of a bind on a site I did too. Very handy!
    – webaware
    Dec 14, 2012 at 2:42
10

If the URLs are the only difference between the installs you can edit one of the config.php files and add

define('WP_HOME','http://A.mysite.com'); define('WP_SITEURL','http://A.mysite.com');

and to the other config.php add

define('WP_HOME','http://B.mysite.com'); define('WP_SITEURL','http://B.mysite.com');

Both installs will use the same database info only the URLs being different.

However you will have to take care of other possibly different aspects like plugins, users, theme, and so on.

The same way you can define any other different setting case by case.

5
  • exactly what i was thinking. you can define your site URL (without futzing with rewrites) and where your site actually lives. Dec 13, 2012 at 22:05
  • Yes but doesn't that action write to the wp_options database table and change those fields? If so, then it would change it each time someone loads the page and would disable the other site or cause other errors. Dec 13, 2012 at 22:54
  • 2
    You would also have to worry about all of the links inserted into the post, which would be inserted based on the configuration of whatever site is being used to create or edit the particular post.
    – s_ha_dum
    Dec 13, 2012 at 23:38
  • Vinccent, if you use define as described it will not write in the database because update_option is not used in the process
    – K Themes
    Dec 14, 2012 at 8:55
  • K Themes, Thank you for this information. I will also test this theory. The only thing keeping me from using it is the fact that any changes made on the slave site in terms of plugins an updates might interfere with the master site. Dec 14, 2012 at 14:17

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.