WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Multiple WP blogs using same database. (22 posts)

  1. DerekBarker
    Member
    Posted 4 years ago #

    I have a heavily modified version of WP that I am using for a movie blog website.

    What I want to do is create separate websites that use their own template, but use the same information and images from the main website.

    For example: I maintain the main website with 1,500+ pages of content.

    I then create a half dozen sites that use their own template and ads, but display information and images from the main site.

    Working in this way I can maintain one database to promote multiple companies.

    Any help would be appreciated. I have a separate site connected to the database already, that was easy. Images do not load though, and any link I click goes to the main website.

    Thanks!

    main website: http://www.zazzoid.com
    copy: http://tvdl.biz/

    Database works... But the path still points to zazzoid. :-(

  2. DerekBarker
    Member
    Posted 4 years ago #

    I think that it will work if I hard code the SiteURL instead of loading it from the database.

    Working on figuring that out. Bruising my forehead on my desk in the process.

  3. DerekBarker
    Member
    Posted 4 years ago #

    OK...

    Now I think that it will mean I need a separate ABSPATH.

    Any advice would be awesome. I've managed to kill the site a few times now trying to do that. :-)

  4. DerekBarker
    Member
    Posted 4 years ago #

    I manually changed "home" in the main database and that changed the links on both sites.

    Now I am looking for a way for each installation to use a unique variable for "home", but still use the same content.

    As usual, any direction would be greatly appreciated. I am a persistent novice, nothing more.

    I need to figure out what script loads the "home" information from the database...

  5. DerekBarker
    Member
    Posted 4 years ago #

    Looks like I am having a conversation with myself. :-(

    Anyhow, I found this post: http://www.heathersblog.com/2007/multiple-blogs-same-content/comment-page-1/#comment-19993

    It says to create a separate options entry in the database and to connect to that with separate installations. Unfortunately the code she demonstrates with no longer exists in current versions of WP.

    Anybody willing to help alter a current WP install to use shared content but a different options entry? I'll keep plugging away, but I am by no means a programmer. I'm just stumbling along here.

    Any help would be appreciated.

  6. DerekBarker
    Member
    Posted 4 years ago #

    I think that I just need to get secondary versions of WP to access their own version of the 'options' database.

    I've made a copy of 'wp_options' and renamed it 'wp_options2' and then edited "zazzoid.com" to "tvdl.biz" in the database.

    On tvdl.biz I have tried to change every instance of 'wp_options' to 'wp_options2' but the links still go to "zazzoid.com"

    Arghhh!!!! WHY IS IT STILL LOADING THE OLD OPTIONS DATABASE!!?!?!?

    Mother expletiving expletive!

    FYI, I am now testing with version 2.8.6 instead of 2.9.2

    Where-O-where does WP load info from 'wp_options'...? Certainly not anywhere I have changed it as yet.

  7. db1987
    Member
    Posted 4 years ago #

    Hi Derek

    I am currently trying to do more or the less thing.

    I am working through your advice so if I come across anything at the end I will share. If you think of something before me then please let me know.

    Thanks

    David

  8. DerekBarker
    Member
    Posted 4 years ago #

    Hey David,

    Thanks for the reply.

    I keep hitting a wall when I change 'options' to 'options2' in public_html/tvdl/wp-includes/wp-db.php

    As I truly don't know what I am doing, I am just changing 'options' every I find it.

    When I edit this line I am sent to a WP installation page.

    var $tables = array('users', 'usermeta', 'posts', 'categories',
    'post2cat', 'comments', 'links', 'link2cat', 'options2',
    'postmeta', 'terms', 'term_taxonomy', 'term_relationships');
  9. db1987
    Member
    Posted 4 years ago #

    Hi Derek.

    I have two blogs now reading the same data from one database, my only issue now is having the second blog use its own domain for permalinks instead of the primary blog.

    I have site1.com and site2.com, if you go to site2.com the home page stays site2.com unfortunately when you click on a post etc it goes to site1.com/about.

    I think were nearly there.

    David

  10. DerekBarker
    Member
    Posted 4 years ago #

    Hey David,

    That sounds like where I have been stuck all day. Copying the config.php file from site1.com and pasting it into site2.com seems to do the trick with the data.

    Somehow we need to get site2.com to read an alternate version of the 'wp_options' database. In my case it is 'wp_options2'.

    I've given up for the day. I've spent about 12 hours on this and need to clear my head.

    Please post if you manage to get that last step to work.

    Derek

  11. db1987
    Member
    Posted 4 years ago #

    Hi Derek, I have accomplished what we set out to, Im just doing some final checks on it and making sure I have a universal admin for you. I will set up a step by step of what I done for you to have a look at if you like?

    David

  12. DerekBarker
    Member
    Posted 4 years ago #

    Awesome!!

    I'm staring at a database not knowing what I am looking for.

  13. DerekBarker
    Member
    Posted 4 years ago #

    I may have figured it out...

    I couldn't connect to my second options database, so I decided to create a second 'home' database. I named it '2ndhome'.

    Now I am looking for 'home' in /public_html/tvdl/wp-includes/link-template.php and changing it to '2ndhome'

    Also had to make changes to /tvdl/wp-content/themes/ondemand/header-home.php and it seems to work perfectly!!!

  14. db1987
    Member
    Posted 4 years ago #

    Im not quite sure I follow Derek.

    Are you talking about "get_option('home')"?

    I never touched any of that as I wanted to be able to configure the blogs with different options from themes, settings, permalinks, plugins etc etc. I have made a few changes in 3 core files.

    For my sites I wanted to share the users across the sites as well which I have sorted. This doesn't need to be configured if you want users to have to sign up for each site.

    I will post a full markup in the morning, I would email it over but its probably better on here in the hope someone else can benefit from it or advise on perhaps an even easier solution.

    Cheers
    David

  15. DerekBarker
    Member
    Posted 4 years ago #

    That would be awesome. I suspect there is an easier way than what I figured out.

    I also share users, the only thing that is not shared is the template.

    There is still an issue when I use "www" in front of site2, it does not load my gallery images. Without the "www", the galley looks fine. That may not matter as I am reprogramming the gallery to work with an automated script that adds film data and images from imdb.com

    Looking forward to your "how to". Has to be easier than mine.

  16. DerekBarker
    Member
    Posted 4 years ago #

    Hey David,

    Not sure if you will read this. Are you coming back to post how you accomplished this?

    It's been a giant pain making one copy, and I want to make several more. Any help to shorten the process would be tremendous.

    Derek

  17. db1987
    Member
    Posted 4 years ago #

    Hi derek,

    Apologies, I will get round to posting it down, its been a task for a client so Im just finishing the job up.

    David

  18. rainer23
    Member
    Posted 4 years ago #

    Multiple wordpress in one database will slow down your websites dramatically. At least my experience.

  19. DerekBarker
    Member
    Posted 4 years ago #

    I've just deleted everything and am going to try to do this from the beginning again. I need to be able to duplicate sites quickly and easily. For now I am not concerned about how fast the database runs, providing that is actually a factor.

    To recap, I need multiple versions of the same website on different URL's. Images will all be on the main blog, content all comes from the same database. Links and logo will be the only difference.

    I am willing to pay somebody to be my tutor. There are basic things that I do not know how to do that would make this so much easier.

  20. efishant
    Member
    Posted 4 years ago #

    I'm not sure if you are still monitoring, but I have been trying this in my head all day. I just saw your post and wanted to share my thoughts.

    What if you:

    -Install WP separately on its own hosting (or sub domain, etc.)
    -Change the DB login info to match the main DB you want to use in the config file(s)
    -Change permalinks or any other references to your domain name to pull dynamically from the current page URL less anything after .com/ using a modified version of:

    if($_SERVER['HTTPS']!=="on")
      {
         $link = $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
         if (strstr($link, 'www.')) { $www = ""; } else { $www = "www."; }
         $https = "https://";
         $redirect = $https.$www.$link;
         header("Location:$redirect");
      }

    Then it does not matter which site you login to, the content would be the same, and you could still use separate themes, etc.

    Again, this is all in my head...

  21. ri4u
    Member
    Posted 4 years ago #

    I also want to create multiple sites – but with same contents.

    I want to have master store with products. Now each affiliate will have separate websites with same product (but different prices). This different price – can be then managed through custom field. Each affiliate may also have different theme.

    I want to maintain common contents / categories for all the sites.

    How can I use multisite feature of wordpress to achieve it OR any other alternative mode?

  22. markegan
    Member
    Posted 3 years ago #

    @DerekBarker @db1987 did you resolve this problem? if so, I'm keen to hear how.

    @efishant did you ever test this code? it looks great in theory!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.