Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?

share|improve this question
    
If all you want is different domain, some apache rewrite rules should be enough. But depending on what your end goal is, multisite setup will probably work better for you. I.e. what do you want the two sites to share? –  ltfishie Mar 23 '12 at 18:40
    
if you don't need the sites to share data and just use the same database you can set up both sites with the same database but different prefix like: jack_, jill_ –  Bainternet Mar 23 '12 at 21:00
add comment

3 Answers

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.

share|improve this answer
add comment
up vote 1 down vote accepted

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:

define('WP_SITEURL','http://jack.example.com/test_blog/');

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

share|improve this answer
    
Why not use the network feature? codex.wordpress.org/Create_A_Network –  developdaly Apr 18 '12 at 21:44
    
this is for development & testing purposes, the multi-site feature wouldn't be applicable here. –  GSto Apr 19 '12 at 20:52
add comment

Use a different prefix for each WP installation. In this way all the tables will be prefixed with the prefix of your choice.

share|improve this answer
add comment

Your Answer

 
discard

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.