Support » Networking WordPress » Different domains with same server and database

  • Resolved linkfr

    (@linkfr)


    Hi everyone!

    I want to create 2 different websites with WordPress (different domains, same server, same database) and i am having this problem:

    I managed to create two different admin interfaces (still no network – which i previously achieved but dont want again for the moment). Each admin for a different site – say http://www.mysite1.com and http://www.websitetwo.net (both on the same server, which is allowed by my host, and both in the same database with different prefixes each for their tables, for example wpS1_ and wpS2_).

    I can add content to both sites and put them on line, but the problem is whenever i try to see the final sites (access http://www.mysite1.com or http://www.websitetwo.net from the address bar) i can only see one of them no matter the domain i type!

    Indeed, the site displayed will always be the one indicated in index.php (wpS1 or wpS2), which i modified as follows :

    /** Loads the WordPress Environment and Template */
    require('./wpS1/wp-blog-header.php');
    ?>

    Thanks to info i found in forums, i also modified my wp-config.php this way:

    // table prefix for hosting multiple intalltaions in the same db.
    switch ($_SERVER[’HTTP_HOST’]) {
    case “www.mysite1.com”:
        $table_prefix = “wpS1_’;
        break;
    case “www.websitetwo.net”:
        $table_prefix = “wpS2_’;
        break;
    }

    Or should i put this?:

    // table prefix for hosting multiple intalltaions in the same db.
    $table_prefix = ereg_replace('^(www\.)', '', $_SERVER['HTTP_HOST']);
    $table_prefix = ereg_replace('\.', '', $table_prefix);
    $table_prefix = $table_prefix . '_';

    I saw no change really.

    As for my General settings in Admin they are set this way:

    – WordPress Address (URL): http://www.mysite1.com/wpS1 (or websitetwo.net/wpS2)
    – Site Address (URL): http://www.mysite1.com (or websitetwo.net)

    How can i manage to display both sites on line?

    Thanks for your help!

Viewing 8 replies - 1 through 8 (of 8 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    Deleted blank post.

    Why not just install WP once, in the root of your domain (www.site1.com) and then turn on multisite. Create site2 (sitew.com/site2) and then use the domain mapping plugin to map it?

    Thread Starter linkfr

    (@linkfr)

    So you mean i can create site1.com in the root directory first and then a second site in a subcarpet such as site1.com/site2? I guess this should be made from WordPress interface and not Control Panel, right?

    To finally map the second site, within the WordPress interface as well, so that it is on line not like site1.com/site2 but simply like http://www.site2.net?

    This would mean i made i mistake at the mapping level when i first installed a multisite network…

    Would you please just confirm if i understood and if i would have at the end two independent sites with two independent url such as http://www.site1.com and http://www.site2.net with not longer paths before i try it all again?

    Thanks a lot for your help!

    Thread Starter linkfr

    (@linkfr)

    Something else: By the way, what about the tables in the database and the prefix in wp-config.php?

    One prefix, one table for all the sites?

    I think that was my problem when i first created the multisite network – it presented the header images of the main site but not those of the other sites.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    Would you please just confirm if i understood and if i would have at the end two independent sites with two independent url such as http://www.site1.com and http://www.site2.net with not longer paths before i try it all again?

    Yes and no.

    You would have two DOMAINS (i.e. 2 URLs), but the sites aren’t 100% independent. they run off the same WP install, use the same set of themes and plugins, and have access to the same user-base.

    Read http://codex.wordpress.org/Create_A_Network – You leave the prefix and DB alone, it makes additional TABLES for you.

    Thread Starter linkfr

    (@linkfr)

    I did manage to create a network first and i think that was precisely one of the reasons why i came to try to create independent sites.

    So that means if i installed a social network or a forum plugin in one of the sites it would be unremovable in the other?

    Indeed one of my sites is intended to be a magazine, the other a showcase website, the other a forum… so themes, pages, formats, elements, fonts, etc. would all be very different.

    Should i better create independent sites?

    Someone in the French forum suggested me installing several WordPress, one for each domain, each in a different carpet. Would that be a solution?

    Thanks a lot for your patience.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    So that means if i installed a social network or a forum plugin in one of the sites it would be unremovable in the other?

    Unremovable is the wrong word.

    If you install a plugin, all sites on the network have access to activate it, but it won’t show up unless you force it. So if you use bbPress, for example, you can activate it on each site. Or not.

    And each site can use a different theme with different settings.

    The social network, though depends on what you use. BuddyPress can be installed on one site only, but it’s tricky.

    Thread Starter linkfr

    (@linkfr)

    Hi again, thanks a lot really, i finally got it…!

    Indeed i hadnt understood the site ID system (1, 2, 3… for the mapping) the first time i installed the network and multisite plugin…

    But now it works – i’ve got a network with two sites, each with its own domain.

    Thanks a lot again, have a good time!

    Thread Starter linkfr

    (@linkfr)

    Hi Ipstenu! hi everyone!

    I’ve got a question, i hope you can help me – even if there is one certainly, i didnt find an answer in the forum.

    I created the multisite and the different sites in it…

    Problem: Whenever i type http://www.site2.net in google it takes me into site1.com

    Where and how could i solve this? I guess this is domain mapping but everything looked well. Thanks a lot for your help!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Different domains with same server and database’ is closed to new replies.