Support » Plugins and Hacks » Sharing a WP database on two domain names (same server)

Sharing a WP database on two domain names (same server)

  • Hi!
    This question has probably been asked before (I did a quick search on the forum, but I’m not sure I used the correct words). I have three domain names, all hosted on the same server. On my server, I have a working WP install, linked to domain1.com. sub.domain1.com is currently running on dotclear, which I plan to get rid off. domain2.com is not doing anything for the moment.
    For organisation purposes, I’d like to have ONE wordpress database, and call different categories on my different domain names. Is that even possible ? domain1.com has a need for a full WP install, whereas sub.domain1.com and domain2.com only need the output of 1 category each. I think it would be a real waste of space and database to have three wordpress installs on the same server, as the websites all share some content.
    So, is it possible or should I install a fresh WP ? If it’s not possible between domain1.com and domain2.com, is it possible between domain1.com and sub.domain1.com ?
    Thanks for all input and advice ! 🙂

Viewing 5 replies - 1 through 5 (of 5 total)
  • You could install WordPress in each domain/subdomain (see Installing Multiple Blogs).

    You could have WordPress in one domain and use this technique in the other domain(s)–Integrating_WordPress_with_Your_Website.

    Andy Christian


    Contributor Day Volunteer

    I’ve done it before, using either 2 databases, or at least 2 separate database prefixes. You just need to add a bit of code at the top of wp_config.php that grabs the current domain name and then gives the appropriate value for either the database, or the prefix.

    I’d post the code, but I’m to tired to figure it out. But at least you know it can be done. 🙂

    I’m not sure I really understand it. The point is to have only ONE database, ONE wordpress installation. It’s more of a htaccess redirect thing, but I don’t know if it’s possible.
    It’s like you have http://www.mydomain1.com/blog/category/cat1
    and http://sub.mydomain1.com/blog/category/cat2
    Both cat1 and cat2 being on the same database and the same wordpress install. I don’t know if it’s clear ?
    If I need to use 2 databases, or 2 databases prefixes, I can also install it twice on the server, it’s not the files I don’t want duplicated, it’s the database. Some categories will be shared between the three websites, I don’t want to have to update them all the time with duplicate content.
    The design will be different on each website, so basically, I need to call the same database from each domain.

    Anybody ? 🙁

    So, nobody likes me ? 🙁

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Sharing a WP database on two domain names (same server)’ is closed to new replies.
Skip to toolbar