Is there a way to use the same database, tables and all, with two different domains? For example, two employees each have thier own subdomain to develop / test with, so there may be two instances of a site:
jack.example.com/test_blog/
jill.example.com/test_blog/
however, since the base url is stored in the database, it seems that it would require two distinct databases for this set up to work properly. Is there any way around this?
Turns out that instead of relying on the Database for a URL, you can set it in the config file, which solves the problem I was having, like so:
and then I set use a different config file for the other instance.
soruce: http://codex.wordpress.org/Editing_wp-config.php#WordPress_address_.28URL.29
WordPress has native support for running multiple instances within one WordPress install since the release of 3.0. Creating a network, previously ‘WordPress Multisite or MU’ has full documentation here. This would allow you to have the sub-domains as well as one easy to manage admin.
Use a different prefix for each WP installation. In this way all the tables will be prefixed with the prefix of your choice.
Should someone else need this… I had a requirement to setup a test environment where we could test code but the actual content needed to be identical and constantly synced with the live site (we only made use of the WordPress API for this project).
There were a few options such as MYSQL database replication however it turns out the simplest was to just to set the second instance (our test site) of WordPress to connect to the database of out live site and then we used the following on the test site in the wp-config.php file.
define( 'WP_HOME', 'http://xxxxxxxx.com' );
Above we define the domain of our test site. This allows the test site to grab the content from the live site but override the url so it works without any problems.
Two WordPress installations getting their content from the same tables in the same database from one server and a single point of entry/management.