Support » Installing WordPress » multiple sites? or multiple installations?

  • sallam

    (@sallam)


    Hi

    I’m newbie here.
    Before installation, I would like to know this:
    does WP supports multiple sites, running from one installation?
    Basically, I need to use it to run idependantly several suddomains, under one domain name. Example: cars.mydomain.com, shopping.mydomain.com, books.mydomain.com, etc..

    What is the best setup to do so?
    If multiple sites feature is not supported, then should I install it several times, each in its own subdomain? and can I use one database, changing only the prefix in each installation?

    Or can I use one installation but each category has a different subdomain link?

    Many thanks in advance.

Viewing 7 replies - 1 through 7 (of 7 total)
  • lawtai

    (@lawtai)

    In order to have WP on multiple sites, you’d need multiple installations of WP. There is a version of WP out there that will allow multiple blogs, but I have no idea how stable or good it is. I’d still suggest multiple installations.

    Yes, you can use 1 database and just change prefix for each installation. That would probably be the best thing to do unless you have access to unlimited databases.

    Avenir

    (@avenir)

    The MU version allows multiple blogs, but is only experimental. So, you shouldn’t use it for your main blog.

    Multiple installs aren’t that bad. WordPress is a small program, comparatively, so multiple installs aren’t bad. And yea, you can use one database as long as the table prefixes are different.

    does anyone have any more info on how to use one database with multiple installs.. ?

    what file do you need to edit?

    My brother and I just setup our sites that way. It was actually pretty easy. All the sites are virtual hosts in apache. They all share the same webroot (thus wordpress installation). They share one database with different table prefixes.

    Here’s what my brother did in wp-config.php:


    //This is safe code, not the leanest
    $domain = $_SERVER["HTTP_HOST"];
    $parts = split("\.",$domain);
    if (count($parts) == 3) {
    $domain = $parts[1] . "." . $parts[2];
    } else {
    $domain = $parts[0] . "." . $parts[1];
    }

    switch ($domain) {
    case "saltjunkie.com":
    $table_prefix = 'sj_';
    break;
    case "4thewin.com":
    $table_prefix = 'ftw_';
    break;
    case "photochi.com":
    $table_prefix = 'pc_';
    break;
    case "carbinated.com":
    $table_prefix = 'cb_';
    break;
    default:
    $table_prefix = 'sj_';
    }

    Seems to work perfectly. The only caveat, and I don’t see this as a problem, is that any installed themes are available to all the sites. I’ve setup each of the above sites with their own themes, so they’re free to edit them without affecting each other. But any site could use any other’s theme. Not a problem in my scenario.

    The key is the having all the sites share the same webroot as apache virtual hosts. The config file parses the domain name from the request and switches the table prefix to the right database. No muss, no fuss.

    Moderator James Huff

    (@macmanx)

    Volunteer Moderator

    When I make the change Dune suggests above, and install, my blogs show the correct posts, but get forwarded to the first blog when trying trying to log in wp-admin from the second domain (both point to the same files – the second domain is a virtual host).

    If anyone can help me sort this out, I would really appreciate it. I can see in the db that the new tables were created. Is there another file that needs to be modified to make this work besides wp-cnofig.php?

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘multiple sites? or multiple installations?’ is closed to new replies.