Forums

[resolved] Two blogs same DB How to do that (5 posts)

  1. nagendra12
    Member
    Posted 1 year ago #

    Hi all,

    I have two blogs and i want to use same DB. Problem what i am facing is.

    with the site URL entry in the DB. for one Blog it is working perfect. If i open another blog then it is getting redirected to first blog. how to stop it, i know i have to write a custom code for that but i am blank where to write it??

    Can you please help me out in this issue as soon as possible

  2. myinstinctwaswrong
    Member
    Posted 1 year ago #

  3. nagendra12
    Member
    Posted 1 year ago #

    that was helpful, but does not help my situation.

    my situation is
    1.http://www.site1.com
    2.http://www.site2.com

    Both sites should access same DB and same Data except the UI means same theme same style.css file, but in site2.com images and colors will be different.

    because in DB the siteurl has got http://www.site1.com , when ever i try to open site2.com it is getting redirected to site1.com

    Hope you understood my situation

  4. moshu
    Member
    Posted 1 year ago #

    Both sites should access same DB

    That is not likely to happen.

  5. nagendra12
    Member
    Posted 1 year ago #

    Finally I Got that ...

    I have edited the Functions.php page i got the things as i wanted
    // If home is not set use siteurl.
    i set home value to null in DB and

    edited functions.php
    with this code
    if ( 'home' == $setting && '' == $value )
    { //return get_option( 'siteurl' );
    if (strpos($_SERVER['HTTP_HOST'],"site2.com")>0)
    return "http://www.site2.com/";
    }

    if ( 'siteurl' == $setting )
    { //return get_option( 'siteurl' );
    if (strpos($_SERVER['HTTP_HOST'],"site2.com")>0)
    return "http://www.site2.com/";
    else
    return "http://www.site1.com/";
    }

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.